caoge c760052ff9 机车状态修改 | hai 8 meses | |
---|---|---|
.. | ||
test | hai 8 meses | |
.editorconfig | hai 8 meses | |
.eslintrc | hai 8 meses | |
.travis.yml | hai 8 meses | |
LICENSE | hai 8 meses | |
README.md | hai 8 meses | |
index.js | hai 8 meses | |
package.json | hai 8 meses |
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