foreach-elegant

0.9.0 • Public • Published

foreach-elegant

Travis CI Build Status NPM version NPM downloads Dependency Status Dev Dependency Status
Slack community badge Patreon donate button Gratipay donate button Flattr donate button PayPal donate button Bitcoin donate button Wishlist browse button

A foreach that supports arrays and objects, provides the value and key/index, as well as break support on return false

Install

NPM

  • Install: npm install --save foreach-elegant
  • Module: require('foreach-elegant')
  • Browserify

    • Install: npm install --save foreach-elegant
    • Module: require('foreach-elegant')
    • CDN URL: //wzrd.in/bundle/foreach-elegant@2.0.1
    • Ender

      • Install: ender add foreach-elegant
      • Module: require('foreach-elegant')
      • 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)

        History

        Discover the release history by heading on over to the HISTORY.md file.

        Backers

        Maintainers

        These amazing people are maintaining this project:

        Sponsors

        No sponsors yet! Will you be the first?

        Patreon donate button Gratipay donate button Flattr donate button PayPal donate button Bitcoin donate button Wishlist browse button

        Contributors

        These amazing people have contributed code to this project:

        Discover how you can contribute by heading on over to the CONTRIBUTING.md file.

        License

        Unless stated otherwise all works are:

        and licensed under:

        Package Sidebar

        Install

        npm i foreach-elegant

        Weekly Downloads

        3

        Version

        0.9.0

        License

        MIT

        Last publish

        Collaborators

        • bevryme