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

cls-bluebird

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cls-bluebird - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

.jshintrc

12

package.json
{
"name": "cls-bluebird",
"version": "1.0.1",
"version": "1.1.0",
"description": "Make bluebird work with the continuation-local-storage module.",

@@ -27,12 +27,10 @@ "main": "shim.js",

"dependencies": {
"shimmer": "~1"
"shimmer": "^1.1.0"
},
"devDependencies": {
"tap": "~0.4.4",
"redis": "~0.9.0"
},
"peerDependencies": {
"continuation-local-storage": "~3",
"bluebird": ">=1.0.3"
"redis": "~0.9.0",
"continuation-local-storage": "^3.1.7",
"bluebird": "^2.10.2"
}
}

@@ -6,2 +6,15 @@ # continuation-local-storage support for bluebird promises

For documentation, check the above link.
It works in the same way and uses the same tests.
It works in the same way and uses the same tests.
Only difference is the call signature. You can provide a specific Bluebird constructor to be shimmed, rather than the default.
API: `clsBluebird( ns [, Promise] )`
```js
var cls = require('continuation-local-storage');
var ns = cls.createNamespace('NODESPACE');
var Promise = require('bluebird');
var clsBluebird = require('clsBluebird');
clsBluebird(ns, Promise);
```

@@ -5,9 +5,20 @@ 'use strict';

module.exports = function patchBluebird(ns) {
var Bluebird;
try {
Bluebird = require('bluebird');
} catch (err) {}
module.exports = function patchBluebird(ns, Promise) {
if (typeof ns.bind !== 'function') {
throw new TypeError("must include namespace to patch bluebird against");
throw new TypeError('must include namespace to patch bluebird against');
}
var Promise = require('bluebird');
var proto = Promise && Promise.prototype;
if (!Promise) {
Promise = Bluebird;
if (!Promise) throw new Error('could not require bluebird');
} else if (!isBluebirdConstructor(Promise)) {
throw new TypeError('promise implementation provided must be bluebird');
}
var proto = Promise.prototype;
shimmer.wrap(proto, '_addCallbacks', function(_addCallbacks) {

@@ -23,1 +34,9 @@ return function ns_addCallbacks(fulfill, reject, progress, promise, receiver, domain) {

};
function isBluebirdConstructor(Promise) {
return isBluebirdPromise(new Promise(function() {}));
}
function isBluebirdPromise(promise) {
return Object.prototype.hasOwnProperty.call(promise, '_promise0');
}

Sorry, the diff of this file is not supported yet

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