Luis f4296bcada project initialized | il y a 5 ans | |
---|---|---|
.. | ||
test | il y a 5 ans | |
.editorconfig | il y a 5 ans | |
.eslintrc | il y a 5 ans | |
.travis.yml | il y a 5 ans | |
LICENSE | il y a 5 ans | |
README.md | il y a 5 ans | |
index.js | il y a 5 ans | |
package.json | il y a 5 ans |
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