0.2.0 • Published 11 years ago

gntr v0.2.0

Weekly downloads
1
License
MIT
Repository
github
Last release
11 years ago

gntr

Tree traversal using ES6 generators, influenced by pep-0255

Currently you must use the --harmony-generators flag when running node 0.11.x to get access to generators.

Installation:

$ npm install gntr

Example:

var gntr = require('gntr');
var root = gntr.tree(['A','B','C','D','E','F','G','H','I']);
var results = [];

for (let value of gntr.preorder(root)) {
    results.push(value);
}

console.log(results);
// Would log  ['F', 'B', 'A', 'D', 'C', 'E', 'G', 'I', 'H']