Total Complexity | 2 |
Complexity/F | 2 |
Lines of Code | 18 |
Function Count | 1 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | import { findTreeNode } from './findTreeNode'; |
||
2 | |||
3 | export const setTreeValue = ( |
||
4 | treeData, |
||
5 | path, |
||
6 | values, |
||
7 | childIdentifier = 'children', |
||
8 | rootIdentifier = 'root' |
||
9 | ) => { |
||
10 | |||
11 | const node = findTreeNode(treeData, path, childIdentifier, rootIdentifier); |
||
12 | |||
13 | if (node) { |
||
14 | Object.assign(node, values); |
||
15 | } |
||
16 | |||
17 | return treeData; |
||
18 | }; |
||
19 |