net-tree
v8.0.0
Published
*Net Tree* is an algorithm which turns an array of items with expressed dependencies to a stream of items with expressed tree structure.
Readme
Net Tree
Net Tree is an algorithm which turns an array of items with expressed dependencies to a stream of items with expressed tree structure.
Terminology:
- item is an item being processed or the resulting item depending on context
- super item is an item which has identifier matching one of another item's
superIds, it is a super to it (this dictates nesting) - prior item is an item which has identifier matching one of another item's
priorIds, is is a prior to it (this dictates ordering) - hyper item is an item which is a given item but for another super in the item's path, it is a hyper to it (this dictates flashing)
recurse(items, ownerIds)
itemsis an array of items which is never mutated byrecurseidis unique item identifier, most commonly a number of a stringsuperIdsis an array of identifiers of super itemspriorIdsis a map describing from which super of itssuperIdshas item which prior item (dependency for ordering)stateis eitherexpanded(the item should be expanded),collapsed(the item should be collapsed), orundefineddatais any value with the item data
ownerIdsis a map describing for which super of itssuperIdsis item expanded (one at a time)
The return value is a stream of items with these fields:
itemis the item passed in fromitemslevelis the nesting level in the tree, starting at a0for root itemsstateis an expansion state from enumeration of:expandable-explicitly-expandedmeans the item had astateofexpandedand its current super matches its ownerexpandable-implicitly-expandedmeans the item had astateofundefinedand appeared first on prior order (expand by default)expandable-explicitly-collapsedmeans the item had astateofcollapsedor its current super doesn't match its ownerexpandable-implicitly-expandedmeans the item had astateofundefinedand didn't appear first on prior orderunexpandablemeans the item has no subitems
superIdis an effective super of the item (from item'ssuperIds)

Installing
Running
yarn start
Deploying
- Update
CHANGELOG.mdandpackage.json'sversion npm publish
Contributing
For stuff to do, see doc/tasks.
