npm stats
  • Search
  • About
  • Repo
  • Sponsor
  • more
    • Search
    • About
    • Repo
    • Sponsor

Made by Antonio Ramirez

foyer

1.2.0

@yoshuawuyts

npmHomeRepoSnykSocket
Downloads:205
$ npm install foyer
DailyWeeklyMonthlyYearly

foyer

NPM version build status Test coverage

Execute async functions in parallel and trigger a callback when done. Sets the context of the executed functions to itself.

Installation

$ npm i --save foyer

Example

var foyer = require('foyer');

foyer([
  function(done) {setTimeout(function(){done('myError', 'myRes');}, 10)}, 
  function(done) {done('myError2', 'myRes2')}
], function callback(err, res) {return res;});
// => ['myRes2', 'myRes']

API

foyer([functions], callback)

// Define an array of async functions.
var tasks = [
  function(done){done(null, 'hello')}, 
  function(done){done(null, 'world')}
];

// Define the callback to be executed
var cb = function(err, res){return res};

// Run 'Foyer' to execute your tasks and run the callback when finished
foyer(tasks, cb);
// => ['hello', 'world']

License

MIT © Yoshua Wuyts