promise-catch

0.0.1 • Public • Published

Unfinished util script

Setup

What

PromiseCatch turns this:

Promise.all([
	fs.readFileAsync('foo.jpg').catch(() => null),
	fs.readFileAsync('bar.jpg').catch(() => null)
]);

Into this:

Promise.all(promiseCatch([
	fs.readFileAsync('foo.jpg'),
	fs.readFileAsync('bar.jpg')
], null));

Assuming fs.readFileAsync returns a Promise. This can be achieved with a promise library like Bluebird.

Usage

Install

Arrays

Objects

Functions

Why

Calls to Promise.all and similar functions will fail at the first rejected promise. It is particularly useful to be able to avoid this when using generators to mimic the async/ await functionality of ES7.

/promise-catch/

    Package Sidebar

    Install

    npm i promise-catch

    Weekly Downloads

    1

    Version

    0.0.1

    License

    ISC

    Last publish

    Collaborators

    • dlevs