node package manager

component-each

Array / object / string iteration utility

each

Array / object / string iteration utility.

$ component install component/each

Iterate an array:

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

Optionally pass a context object:

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

Iterate an object's key / value pairs:

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

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

each(collection, function(val, i){
  
})

Iterate a string's characters:

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

License

MIT