webmodules / node-iterator

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

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


Languages

Language:JavaScript 81.5%Language:Makefile 18.5%