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

bluebird-settle

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bluebird-settle

Add the settle method to the bluebird 3.x library.

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

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

bluebird-settle

Add the settle method to the bluebird 3.x library.

Important!

You're project must already have bluebird installed via npm. This module will not include bluebird for you, but it will add the settle method to any version of bluebird that you are using.

Usage

var Promise = require('bluebird-settle');

var promises = [
   Promise.resolve(true),
   Promise.resolve('Yes'),
   Promise.reject(new Error('Foo'))
];

Promise.settle(promises)
    .then(function(results) {
        results.forEach(function(result) {
            if (result.isRejected()) {
                console.log('Rejected with reason: ' + result.reason());
            } else if (result.isResolved()) {
                console.log('Resolved with value: ' + result.value());
            }
        });
    });
    
/*
Sample Output

Resolved with value: true
Resolved with value: Yes
Rejected with reason: Error: Foo
*/

Side Note

You only need to require the bluebird-settle library once. You can require it over and over if you want, but you only have to require it once. For example:

index.js

require('bluebird-settle');
var foo = require('./foo');
...

foo.js

var Promise = require('bluebird');
console.log(typeof Promise.settle === 'function');      // true
...

Keywords

FAQs

Package last updated on 05 Feb 2016

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