Bakhtina Sofya b84cb877be 1st comm | 3 minggu lalu | |
---|---|---|
.. | ||
test | 3 minggu lalu | |
.editorconfig | 3 minggu lalu | |
.eslintrc | 3 minggu lalu | |
.travis.yml | 3 minggu lalu | |
LICENSE | 3 minggu lalu | |
README.md | 3 minggu lalu | |
index.js | 3 minggu lalu | |
package.json | 3 minggu lalu |
A better forEach.
Like Array.prototype.forEach
but works on objects.
var forEach = require("for-each")
forEach({ key: "value" }, function (value, key, object) {
/* code */
})
As a bonus, it's also a perfectly function shim/polyfill for arrays too!
var forEach = require("for-each")
forEach([1, 2, 3], function (value, index, array) {
/* code */
})
npm install for-each