Bakhtina Sofya b84cb877be 1st comm | há 3 semanas atrás | |
---|---|---|
.. | ||
test | há 3 semanas atrás | |
.editorconfig | há 3 semanas atrás | |
.eslintrc | há 3 semanas atrás | |
.travis.yml | há 3 semanas atrás | |
LICENSE | há 3 semanas atrás | |
README.md | há 3 semanas atrás | |
index.js | há 3 semanas atrás | |
package.json | há 3 semanas atrás |
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