1.1.0 • Published 4 years ago

bfsearch v1.1.0

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

bfsearch

Breadth-first search a tree

Usage

const bfsearch = require('bfsearch');

bfsearch(tree, node => {
  // Called with each node
});

Tree

  • should look like this
  • nodes may have a children array of other nodes
  • nodes may have any other properties
{
  id: 1,
  children: [
    {
      id: 2,
      children: [
        {
          id: 3
        }
      ]
    }
  ]
}