for-each build status

browser support

A better forEach.

Example

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 */
})

Installation

npm install for-each

MIT Licenced

for-each - Installation

To install for-each via this registry, you'll need to install via the --registry parameter with your package manager.

n

NPM

npm install for-each --registry https://js.registry.sudovanilla.org

Learn more about the --registry parameter.

Yarn

yarn config set registry https://js.registry.sudovanilla.org
yarn install for-each

Learn more about the config option.

PNPM

pnpm install for-each --registry https://js.registry.sudovanilla.org

Learn more about the --registry parameter.

Bun Logo

Bun

bun install for-each --registry https://js.registry.sudovanilla.org

Learn more about the --registry parameter.

Learn more about setting this up in your bunfig.toml configuration.


For Deno, add the following to your .npmrc file in your directory:

registry="https://js.registry.sudovanilla.org"

Then run the deno install command.

for-each - Download

Download Tarball (v0.3.5)

Integrity sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==
SHASUM d650688027826920feeb0af747ee7b9421a41d47
Tarball https://js.registry.sudovanilla.org/for-each/-/for-each-0.3.5.tgz