npm.io
1.0.4 • Published 8 years ago

async-bluebird

Licence
MIT
Version
1.0.4
Deps
2
Size
216 kB
Vulns
1
Weekly
0
Stars
3

async-bluebird

npm version Build Status

A bluebird promisified wrap of async - async utitlities for node and the browser.

I made this because I felt like it's more productive than manually wrapping async functions with Promises every time I want to use them.

Install & Require:

  • npm i async-bluebird
// Promisified async & bluebird Promises
var {async, Promise} = require('async-bluebird');

// Just Promisified async
var async = require('async-bluebird');

Usage:

Example
// With callback:
async.each([1,2,3], (item, callback) => {
  // Callback on each item
}, (err) => {
  if (err) {
    // Handle error
  } else {
    // Success
  }
})

// With Promise:
async.each([1,2,3], (item, callback) => {
  // Callback on each item
}).then(() => {
  // Success
}).catch((err) => {
  // Handle error
});

Why use Promises?

Converting async's utility functions into Promises allows us to easily integrate them with our promise-using code and promise-chains.

Keywords