0.1.2 • Published 10 years ago

bredele-each v0.1.2

Weekly downloads
2
License
BSD
Repository
github
Last release
10 years ago

each

Iteration utility.

Installation

with component:

$ component install bredele/each

with nodejs:

$ npm install bredele-each

API

You'll find lots of iteration components out there (like component-each). However, each exposes a consistent API for both arrays and objects (the first argument is the object's key - or index for an array -).

each(array, fn, scope)

Iterate an array:

each(['olivier', 'bredele'], function(key, val){
  //key is the array's index
})

each(object, fn, scope)

Iterate an object;

each(conf, function(key, val){
  //key is the object's key
})

License

MIT