foreach-elegant
v0.9.0
Published
A foreach that supports arrays and objects, provides the value and key/index, as well as break support on return false
Downloads
9
Maintainers
Readme
A foreach that supports arrays and objects, provides the value and key/index, as well as break support on return false
NPM
Browserify
Ender
Usage
var foreach = require('foreach-elegant')
function iterator (value, key, list) {
console.log('received', key, '=', value, 'from', list)
if ( key === 'b' || value === 'y' ) {
console.log('ending iteration early')
return false
}
}
foreach({a:1, b:2, c:3}, iterator)
foreach(['x', 'y', 'z'], iterator)
foreach({a:1, c:3}, iterator)
foreach(['x', 'z'], iterator)
Discover the release history by heading on over to the HISTORY.md file.
These amazing people are maintaining this project:
No sponsors yet! Will you be the first?
These amazing people have contributed code to this project:
Discover how you can contribute by heading on over to the CONTRIBUTING.md file.
Unless stated otherwise all works are:
and licensed under: