# recursive-iterator

> It iterates through a graph or a tree recursively

Latest version **3.3.0** (published 2017-08-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install recursive-iterator
pnpm add recursive-iterator
yarn add recursive-iterator
bun add recursive-iterator
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.3.0 |
| Published | 2017-08-05 |
| First published | 2015-03-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 91 |
| Author | nerv |
| Maintainers | nerv |
| Keywords | js, javascript, graph, vertex, walk, walker, recursive, recursion, iterator, iteratate, traverse, traversal, object, tree, json |

## Links

- npm: https://www.npmjs.com/package/recursive-iterator
- Repository: https://github.com/nervgh/recursive-iterator
- Issues: https://github.com/nervgh/recursive-iterator/issues
- npm.io page: https://npm.io/package/recursive-iterator

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 3.3.0 (latest) — 2017-08-05
- 3.2.0 — 2017-08-05
- 3.0.0 — 2017-08-05
- 3.1.0 — 2017-08-05
- 2.0.3 — 2016-10-21
- 2.0.2 — 2016-10-21
- 2.0.1 — 2016-08-17
- 2.0.0 — 2015-08-14
- 1.0.0 — 2015-03-17

## README

# Recursive Iterator

[![NPM version][npm-image]][npm-url]
[![Build status][travis-image]][travis-url]
[![Test coverage][coveralls-image]][coveralls-url]

## About
It iterates through a graph or a tree recursively.

## Versions
+ for support ES5 see `2.x.x` versions

## Getting started

### Quick overview (es6)
```js
let iterator = new RecursiveIterator(
    root /*{Object|Array}*/,
    [bypassMode=0] /*{Number}*/,
    [ignoreCircular=false] /*{Boolean}*/,
    [maxDeep=100] /*{Number}*/
);

let {value, done} = iterator.next();
let {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)
```js
let 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
* [Syntax](https://github.com/nervgh/recursive-iterator/wiki/Syntax)
    * [ES6](https://github.com/nervgh/recursive-iterator/wiki/Syntax#es6)
    * [ES5](https://github.com/nervgh/recursive-iterator/wiki/Syntax#es5)
* API
    * [Options](https://github.com/nervgh/recursive-iterator/wiki/Options)
    * [Methods & Callbacks](https://github.com/nervgh/recursive-iterator/wiki/Methods-&-Callbacks)
* [Cookbook (es6)](https://github.com/nervgh/recursive-iterator/wiki/Cookbook-(es6))
    * [Iterator (not recursive)](https://github.com/nervgh/recursive-iterator/wiki/Cookbook-(es6)#iterator-not-recursive)
    * [DomIterator](https://github.com/nervgh/recursive-iterator/wiki/Cookbook-(es6)#domiterator)
    * [Deep copy / Deep clone](https://github.com/nervgh/recursive-iterator/wiki/Cookbook-(es6)#deep-copy--deep-clone)
    * [To Query String](https://github.com/nervgh/recursive-iterator/wiki/Cookbook-(es6)#to-query-string)
    * [To Form Data](https://github.com/nervgh/recursive-iterator/wiki/Cookbook-(es6)#to-form-data)
    * [Uninformed search algorithms](https://github.com/nervgh/recursive-iterator/wiki/Cookbook-(es6)#uninformed-search-algorithms)


## Package managers
### Bower
```
bower install recursive-iterator
```
You could find this module in bower like [_recursive iterator_](http://bower.io/search/?q=recursive%20iterator).

### NPM
```
npm install recursive-iterator
```
You could find this module in npm like [_recursive iterator_](https://www.npmjs.com/search?q=recursive+iterator).


[npm-image]: https://img.shields.io/npm/v/recursive-iterator.svg?style=flat
[npm-url]: https://npmjs.org/package/recursive-iterator
[travis-image]: https://img.shields.io/travis/nervgh/recursive-iterator.svg?style=flat
[travis-url]: https://travis-ci.org/nervgh/recursive-iterator
[coveralls-image]: https://img.shields.io/coveralls/nervgh/recursive-iterator.svg?style=flat
[coveralls-url]: https://coveralls.io/r/nervgh/recursive-iterator?branch=master

---
_Source: https://npm.io/package/recursive-iterator · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
