npm.io
0.3.0 • Published 11 years ago

yiwn-each

Licence
MIT
Version
0.3.0
Deps
1
Vulns
0
Weekly
0

each

Array / object / string iteration utility.

Installation

Install with component:

$ component install yiwn/each

Install with npm for browserify:

$ npm install yiwn-each

API

each(array, fn[, ctx])

Iterate an array:

each([1,2,3], function(num, i){
  
})

Optionally pass a context object:

each([1,2,3], function(num, i){

}, this)
each(object, fn[, ctx])

Iterate an object's key / value pairs:

each(conf, function(val, key){
  
})

Iterate an array-ish object (has numeric .length):

each(collection, function(val, i){
  
})
each(string, fn[, ctx])

Iterate a string's characters:

each('hello', function(c, i){
  
})

License

MIT