Package Exports
- eachr
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (eachr) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Eachr
Give eachr an array or object, and the iterator, in return eachr will give the iterator the value and key of each item, and will stop if the iterator returned false.
Install
NPM
- Use:
require('eachr')
- Install:
npm install --save eachr
Browserify
- Use:
require('eachr')
- Install:
npm install --save eachr
- CDN URL:
//wzrd.in/bundle/eachr@2.0.4
Ender
- Use:
require('eachr')
- Install:
ender add eachr
Usage
// Prepare
var each = require("eachr");
var arr = ["first", "second", "third"];
var obj = {a:"first", b:"second", c:"third"};
var iterator = function(value,key){
console.log({value:value, key:key});
if ( value === "second" ) {
console.log("break");
return false;
}
};
// Cycle Array
each(arr, iterator);
// {"value":"first", "key":0}
// {"value":"second", "key":1}
// break
// Cycle Object
each(obj, iterator);
// {"value":"first", "key":"a"}
// {"value":"second", "key":"b"}
// break
History
Discover the change history by heading on over to the HISTORY.md
file.
Contribute
Discover how you can contribute by heading on over to the CONTRIBUTING.md
file.
Backers
Maintainers
These amazing people are maintaining this project:
- Benjamin Lupton b@lupton.cc (https://github.com/balupton)
Sponsors
No sponsors yet! Will you be the first?
Contributors
These amazing people have contributed code to this project:
License
Unless stated otherwise all works are:
- Copyright © Bevry Pty Ltd us@bevry.me (http://bevry.me)
and licensed under:
- The incredibly permissive MIT License