JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 39263
  • Score
    100M100P100Q152729F
  • License MIT

It iterates anything. The Recursive Iterator supports: ES5/ES6 environments, the ES6 iteration protocols

Package Exports

  • recursive-iterator

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (recursive-iterator) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Recursive Iterator

About

It iterates anything. The Recursive Iterator supports: ES5/ES6 environments, the ES6 iteration protocols / for...of cycle.

Required

ES5

Getting started

Quick overview (es6)

var iterator = new RecursiveIterator(
    root /*{Object|Array}*/,
    [bypassMode=0] /*{Number}*/,
    [ignoreCircular=false] /*{Boolean}*/,
    [maxDeep=100] /*{Number}*/
);

var {value, done} = iterator.next();
var {parent, node, key, path, deep} = value;

// parent is parent node
// node is current node
// key is key of node
// path is path to node
// deep is current deep

Example (es6)

var root = {
    object: {
        number: 1
    },
    string: 'foo'
};

for(let {node, path} of new RecursiveIterator(root)) {
    console.log(path.join('.'), node);
}

// object    Object {number: 1}
// object.number    1
// string    foo

Roadmap

Package managers

Bower

bower install recursive-iterator

You could find this module in bower like recursive iterator.

NPM

npm install recursive-iterator

You could find this module in npm like recursive iterator.