Hi, I cannot understand why
find({name: name.substring(0, i), children: []}).children.push(data);
modifies the map.
There is no set() method that modifies it.
Very confused !
It is a recursive call to the function itself. The map is modified when map.set is called.
Note that not all calls to find is with the root data map. The recursive calls are with empty children.