node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

node-iterator

node-iterator

A ES6 Generator that traverses the child nodes within the given Node

Sauce Test Status

Build Status

Installation

$ npm install node-iterator

Example

import NodeIterator from 'node-iterator';
 
// manual iteration 
let node;
for (node of NodeIterator(document.body)) {
  console.log(node.nodeName);
}
 
// cast to an Array 
let nodes = [...NodeIterator(document.body)];
console.log(nodes.length);

License

MIT