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

bluebird-tools

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bluebird-tools - npm Package Compare versions

Comparing version 1.3.1 to 1.3.2

2

package.json
{
"name": "bluebird-tools",
"version": "1.3.1",
"version": "1.3.2",
"description": "",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -123,6 +123,13 @@ # Bluebird Tools

#### Promise.convert(promise) -> promise
#### Promise.convert(promise) -> `promise`
Converts a native promise to a BluebirdTools promise
```js
Promise.convert(promise)
```
```
#### promise.isBluebird -> `bool`
Converts a native promise to a BluebirdTools promise
```js
if (Promise.resolve().isBluebird) { // true
}
```

@@ -94,8 +94,12 @@ const Promise = require('bluebird');

Promise.prototype.isBluebird = true;
Promise.convert = function convert(promise) {
return new Promise((resolve, reject) => {
promise
.then(resolve)
.catch(reject);
});
return promise.isBluebird
? promise
: new Promise((resolve, reject) => {
promise
.then(resolve)
.catch(reject);
});
};

@@ -102,0 +106,0 @@

@@ -10,6 +10,19 @@ const BluebirdPromise = require('../src');

assert.isFunction(promise['iif']);
assert.isNotFunction(vanillaPromise['iif']);
assert.isUndefined(vanillaPromise.isBluebird);
assert.isTrue(promise.isBluebird);
});
});
context('#isBluebird', () => {
it('a vanilla Promise must have isBluebird as undefined', () => {
const promise = Promise.resolve();
assert.isUndefined(promise.isBluebird);
});
it('a Bluebird Promise must set isBluebird true', () => {
const promise = BluebirdPromise.resolve();
assert.isTrue(promise.isBluebird);
});
});
});
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