gather

0.1.0 • Public • Published

npm

gather

Build Status Dependency Status

Control flow utility that runs a callback after all the dependencies are (asynchronously) met. Useful when a function depends on some resources that are obtained asynchronously and independently.

Example

var done = gather(function (a, b) {
  console.log(+ b);
});
 
async(function () {
  async(function () {
    done('foo', undefined);
  });
});
 
async(function () {
  done(undefined, 'bar');
});
 
// Prints "foobar".

API

feed = gather(done)

Returns a function that can feed results to done.

Pass arguments as they become ready, interleaving with undefined for not-yet-resolved ones. The order and total count matter.

Once all the arguments are supplied, done is finally called.

Install

npm install gather

License

MIT

/gather/

    Package Sidebar

    Install

    npm i gather

    Weekly Downloads

    1

    Version

    0.1.0

    License

    MIT

    Last publish

    Collaborators

    • eush77