main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
746 bytes
|
Line | |
---|
1 | # for-each [![build status][1]][2]
|
---|
2 |
|
---|
3 | [![browser support][3]][4]
|
---|
4 |
|
---|
5 | A better forEach.
|
---|
6 |
|
---|
7 | ## Example
|
---|
8 |
|
---|
9 | Like `Array.prototype.forEach` but works on objects.
|
---|
10 |
|
---|
11 | ```js
|
---|
12 | var forEach = require("for-each")
|
---|
13 |
|
---|
14 | forEach({ key: "value" }, function (value, key, object) {
|
---|
15 | /* code */
|
---|
16 | })
|
---|
17 | ```
|
---|
18 |
|
---|
19 | As a bonus, it's also a perfectly function shim/polyfill for arrays too!
|
---|
20 |
|
---|
21 | ```js
|
---|
22 | var forEach = require("for-each")
|
---|
23 |
|
---|
24 | forEach([1, 2, 3], function (value, index, array) {
|
---|
25 | /* code */
|
---|
26 | })
|
---|
27 | ```
|
---|
28 |
|
---|
29 | ## Installation
|
---|
30 |
|
---|
31 | `npm install for-each`
|
---|
32 |
|
---|
33 | ## Contributors
|
---|
34 |
|
---|
35 | - Raynos
|
---|
36 |
|
---|
37 | ## MIT Licenced
|
---|
38 |
|
---|
39 | [1]: https://secure.travis-ci.org/Raynos/for-each.png
|
---|
40 | [2]: http://travis-ci.org/Raynos/for-each
|
---|
41 | [3]: https://ci.testling.com/Raynos/for-each.png
|
---|
42 | [4]: https://ci.testling.com/Raynos/for-each
|
---|
43 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.