README
======= Loop.js
Cross platform async helpers.
.. image:: https://travis-ci.org/kevinconway/Loop.js.png?branch=master :target: https://travis-ci.org/kevinconway/Loop.js :alt: Current Build Status
What Is Loop?
Loop is a utility designed to make it easier to run async functions in a loop. All loops return an A+ compliant promise that is resolved when the loop is completed.
Show Me
.. code-block:: javascript
var list = [1, 2, 3, 4, 5],
asyncDouble = function (value) {
// Any A+ compliant promise will work.
var promise = new SomePromiseImplementation();
// Do something async and resolve the promise with a value.
setImmediate(promise.resolve.bind(promise, value * 2));
return promise;
};
loopjs.map(list, asyncDouble).then(function (newList) {
console.log(newList); // [2, 4, 6, 8, 10]
});
Currently supported iterations are:
for.each, for.in, for.x, until.true, until.false, map, reduce, select,
remove, find, all, and none.
For more use cases, examples, and API documentation see the 'doc' directory.
Setup
Node.js
This package is published through NPM under the name loopjs
::
$ npm install loopjs
Once installed, loopjs = require("loopjs")
.
Browser
This module uses browserify to create a browser compatible module. The default grunt workflow for this project will generate both a full and minified browser script in a build directory which can be included as a