Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

p-settle

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

p-settle

Settle promises concurrently and get their fulfillment value or rejection reason

  • 5.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
395K
decreased by-31.77%
Maintainers
1
Weekly downloads
 
Created

What is p-settle?

The p-settle npm package is used to settle multiple promises and get their results regardless of whether they were fulfilled or rejected. It returns an array of objects with the state and value/reason of each promise.

What are p-settle's main functionalities?

Settling multiple promises

This feature allows you to settle multiple promises and get their results regardless of whether they were fulfilled or rejected. The output is an array of objects with the status and value/reason of each promise.

const pSettle = require('p-settle');

const promises = [
  Promise.resolve('Success'),
  Promise.reject(new Error('Failure')),
  Promise.resolve('Another success')
];

pSettle(promises).then(results => {
  console.log(results);
  /*
  Output:
  [
    { status: 'fulfilled', value: 'Success' },
    { status: 'rejected', reason: Error: Failure },
    { status: 'fulfilled', value: 'Another success' }
  ]
  */
});

Other packages similar to p-settle

Keywords

FAQs

Package last updated on 09 Oct 2023

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