props-iterator

1.0.1 • Public • Published

props-iterator

Iterates all properties (owned and inherited) of an object.

Installation

Requires Node.js 7.0.0 or above.

npm i props-iterator

API

The module exports a single function.

Parameters

  1. Bindable: obj (object): The object whose properties you want to iterate.
  2. Object argument:
    • Optional: own (boolean): If set to true, only the object’s “own” properties are iterated. If omitted or if set to false, both owned and inherited properties are returned.
    • Optional: enumOnly (boolean): If set to true, only properties defined with the enumerable flag will be iterated.

Return Value

An iterator that yields two-element key-value-pair arrays.

Example

const props = require('props-iterator')
 
const iter = props({key: 'value'}, {own: true})
iter.next().value // ['key', 'value']
iter.next().done // true

Related

Package Sidebar

Install

npm i props-iterator

Weekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

3.26 kB

Total Files

4

Last publish

Collaborators

  • lamansky