Last Updated on August 28, 2018 by Colin
Recursion in programming can be a mind bender.
These examples are dependent on lodash methods.
Hopefully these code patterns are useful to you. I find them useful as starting points when I have to code some new recursion.
This function, “omitDeep” deletes an object property wherever it is found in any node or sub-node of the object.
This is a recursive version of lodash’s ‘omit‘.
This is adapted a little bit from this thread on StackOverflow.
This function “printTreePaths” takes an array of tree nodes (such as a representation of a file system or some other hierarchy) and produces an array of the printable paths.