Total Complexity | 2 |
Complexity/F | 2 |
Lines of Code | 17 |
Function Count | 1 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 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 { |
||
12 | node, |
||
13 | indexPath |
||
14 | } = findTreeNode(treeData, path, childIdentifier, rootIdentifier); |
||
15 | |||
16 | return !node ? treeData : treeData.mergeIn(indexPath, values); |
||
17 | }; |
||
18 |