JSPM

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

Iterates javascript object recursively. Supports 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

Iterates javascript object recursively. Works in ES5 and ES6 environments. Supports ES6 iteration protocols. Compatible with 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