treecko
treecko copied to clipboard
A collection of functional and immutable helpers for working with tree data structures.
treecko
A collection of functional and immutable helpers for working with tree data structures.
- Both Trees : Object and Tree Lists : Array<Object> are supported.
- Curried for easy partial application.
Mapping
- softMap
- softMapBy
- hardMap
- hardMapBy
Reducing
- reduce
- reduceAncestryBy
Finding
- findOr
Filtering
- filter
- reject
Side Effects
- each
Flattening
- flatten
- superflatten
- flattenToIds
- flattenToMap
Restructuring
- replaceChildrenBy
- addChildBy
- changeParent
Misc
- hasId
TODO
- [ ] Support different values for
children
key - [ ] Support different values for
id
key inflattenToMap
andchangeParent
- [ ] Support different values for
parentId
key inchangeParent
- [ ] Add breadth-first versions of methods