foreach
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/foreach package

2.0.6 • Public • Published

foreach

CDNJS

Iterate over the key value pairs of either an array-like object or a dictionary like object.

browser support

API

foreach(object, function, [context])

var each = require('foreach');

each([1,2,3], function (value, key, array) {
    // value === 1, 2, 3
    // key === 0, 1, 2
    // array === [1, 2, 3]
});

each({0:1,1:2,2:3}, function (value, key, object) {
    // value === 1, 2, 3
    // key === 0, 1, 2
    // object === {0:1,1:2,2:3}
});

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.0.6
    1,474,474
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 2.0.6
    1,474,474
  • 2.0.5
    12,684,730
  • 2.0.4
    383,704
  • 2.0.3
    118
  • 2.0.2
    106
  • 2.0.1
    116
  • 2.0.0
    114
  • 1.3.3
    112

Package Sidebar

Install

npm i foreach

Weekly Downloads

2,100,082

Version

2.0.6

License

MIT

Unpacked Size

8.73 kB

Total Files

7

Last publish

Collaborators

  • manuelstofer