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

native-or-another

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

native-or-another

Export either the native Promise or Bluebird (using native-or-bluebird) as deferred object.

  • 2.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.3K
decreased by-11.17%
Maintainers
1
Weekly downloads
 
Created
Source

npm version mit license build status coverage status deps status

Export either the native Promise or Bluebird (using native-or-bluebird) as deferred object.

Install

$ npm install native-or-another
$ npm test

Usage

For more use-cases see the tests

var assert = require('assert');
var Deferred = require('native-or-another');
var defer = new Deferred();

defer.resolve(1);
defer.promise.then(function fulfilled(val) {
  assert.strictEqual(val, 1);
  done();
});

// catching errors
defer.reject(new Error('custom error'));
defer.promise.catch(function rejected(err) {
  assert.ok(err instanceof Error);
  assert.strictEqual(err.message, 'custom error');
  done();
});

Author

Charlike Mike Reagent

License MIT license

Copyright (c) 2014 Charlike Mike Reagent, contributors.
Released under the MIT license.


Powered and automated by readdirp + hogan.js, December 21, 2014

Keywords

FAQs

Package last updated on 21 Dec 2014

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