New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

promise-all-forgiving

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

promise-all-forgiving

Promise.all() without the fail-fast behavior

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-94.12%
Maintainers
1
Weekly downloads
 
Created
Source

promise-all-forgiving

Promise.all() has a fail-fast behavior, which means that if any of the promises reject, then Promise.all() will reject. Sometimes you don't want this behavior, and that's where promise-all-forgiving comes in. If one or more promises reject, it will continue to wait for all promises to complete and resolve with an array of any resolved values and rejected errors.

Installation

Install using NPM:

$ npm i promise-all-forgiving

Usage

Import the function:

const promiseAllForgiving = require('promise-all-forgiving');

const promise1 = Promise.resolve('one');
const promise2 = Promise.reject(new Error('two'));
const promise3 = Promise.resolve('three');

promiseAllForgiving([promise1, promise2, promise3])
  .then(data => {
    // handle the array of resolved/rejected data
    
    // you could use "instance of Error" to check if each value is an Error (rejected Promise)
  })

Keywords

FAQs

Package last updated on 19 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc