Answer the question
In order to leave comments, you need to log in
How can the function with duplicates be simplified and improved?
The code is the following:
updateResultat(node: any, field: DocumentField): void {
if (field.fieldvalue == 1) {
this.dfs_change(node.children, { name: 'visible', value: true }, { name: 'tag', value: 'OPERATORTYPE' });
} else {
this.dfs_change(node.children, { name: 'visible', value: false }, { name: 'tag', value: 'OPERATORTYPE' });
}
if (field.fieldvalue == 2) {
this.dfs_change(node.children, { name: 'visible', value: true }, { name: 'tag', value: 'MAILTYPE' });
} else {
this.dfs_change(node.children, { name: 'visible', value: false }, { name: 'tag', value: 'MAILTYPE' });
}
if (field.fieldvalue == 3) {
this.dfs_change(node.children, { name: 'visible', value: true }, { name: 'tag', value: 'MAILADDRESS' });
} else {
this.dfs_change(node.children, { name: 'visible', value: false }, { name: 'tag', value: 'MAILADDRESS' });
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question