# trog

> Recursively iterate through an object

Latest version **0.0.0** (published 2017-07-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install trog
pnpm add trog
yarn add trog
bun add trog
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.0 |
| Published | 2017-07-31 |
| First published | 2017-07-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Barney Carroll |
| Maintainers | barneycarroll |

## Links

- npm: https://www.npmjs.com/package/trog
- Repository: https://github.com/barneycarroll/trog
- Homepage: https://github.com/barneycarroll/trog#readme
- Issues: https://github.com/barneycarroll/trog/issues
- npm.io page: https://npm.io/package/trog

## Recent versions

- 0.0.0 (latest) — 2017-07-31

## README

# trog

`trog` is a generator that consumes an object and recursively iterates through its properties, yielding `[key, value]` pairs.

Iteration is breadth-first by default, meaning all the object's immediate properties will be yielded before recursion. This can be configured using a set of exported symbols:

|key|description|
|---|---|
| `BREAK`   | Stop the current iteration |
| `DESCEND` | Iterate through the last yielded value immediately, resuming current iteration later |
| `DEFER`   | Iterate through the last yielded value after current iteration has finished |
| `SKIP`    | Do not iterate through the last yielded value |

Any of these can be passed in as the second argument to a `trog` generator to define default behaviour (eg passing `SKIP` would avoid recursion; passing `DESCEND` would force depth-first recursion), and any of these can be passed back into the generator (by manual iteration via `next(FLAG)`) to respond to specific conditions. For example, you may wish to `SKIP` circular references, or `BREAK` when you recognise a property to be part of a sub-tree you know you don't need to crawl.

# TODO

* Tests
* Examples
* API refinement

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