/promise-all-soft-fail

This functions much like Promise.all() however it does not fail-fast. It executes all the promises and returns the results.

Primary LanguageJavaScriptMIT LicenseMIT

npm version Coverage Status Build Status

promise-all-soft-fail

This function is designed to add some functionality to the standard Promise.all() that we have come to know and love

Installation

npm install promise-all-soft-fail

Usage

promiseAllSoftFail([promiseArray])

This functions much like Promise.all() however it does not fail-fast. It executes all the promises and returns the results.

let promiseAllSoftFail = require('promise-all-soft-fail').promiseAllSoftFail;

promiseAllSoftFail([Promise.resolve(true),Promise.reject(false)]).then((result)=>{
  console.log(result); //This will print [true,false]
});

promiseAllSoftFailSync([promiseArray])

This executes all the promises in an array in sequential order. It will execute all the promises whether they resolve or reject. This returns an array of the resolved or rejected values.

let promiseAllSoftFailSync = require('promise-all-soft-fail').promiseAllSoftFailSync;

promiseAllSoftFailSync([Promise.resolve(1),Promise.reject(2),Promise.resolve(3)]).then((result)=>{
  console.log(result); //This will print [1,2,3]
});

Tests

Test npm test

Coverage npm run cover

Contributing

In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.