UNPKG

1.07 kBMarkdownView Raw
1# for-in [![NPM version](https://badge.fury.io/js/for-in.svg)](http://badge.fury.io/js/for-in)
2
3> Iterate over the own and inherited enumerable properties of an objecte, and return an object with properties that evaluate to true from the callback. Exit early by returning `false`. JavaScript/Node.js
4
5## Install
6#### Install with [npm](npmjs.org):
7
8```bash
9npm i for-in --save
10```
11
12## Run tests
13
14```bash
15npm test
16```
17
18## Usage
19
20```js
21var forIn = require('for-in');
22
23var obj = {a: 'foo', b: 'bar', c: 'baz'};
24var values = [];
25var keys = [];
26
27forIn(obj, function (value, key, o) {
28 keys.push(key);
29 values.push(value);
30});
31
32console.log(keys);
33//=> ['a', 'b', 'c'];
34
35console.log(values);
36//=> ['foo', 'bar', 'baz'];
37```
38
39## Author
40
41**Jon Schlinkert**
42
43+ [github/jonschlinkert](https://github.com/jonschlinkert)
44+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
45
46## License
47Copyright (c) 2014 Jon Schlinkert, contributors.
48Released under the MIT license
49
50***
51
52_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on September 20, 2014._
\No newline at end of file