0.9.0 • Published 8 years ago

foreach-elegant v0.9.0

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

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:

0.9.0

8 years ago

2.0.1

8 years ago

2.0.0

8 years ago

1.0.0

8 years ago