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

cancelable-promise

Package Overview
Dependencies
Maintainers
3
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cancelable-promise - npm Package Compare versions

Comparing version 2.4.1 to 2.5.0

39

CancelablePromise.js

@@ -41,21 +41,24 @@ const handleCallback = (resolve, reject, callback, r) => {

const p = new CancelablePromise((resolve, reject) => {
this._promise.then((r) => {
if (this._canceled) {
p.cancel();
this._promise.then(
r => {
if (this._canceled) {
p.cancel();
}
if (success && !this._canceled) {
handleCallback(resolve, reject, success, r);
} else {
resolve(r);
}
},
r => {
if (this._canceled) {
p.cancel();
}
if (error && !this._canceled) {
handleCallback(resolve, reject, error, r);
} else {
reject(r);
}
}
if (success && !this._canceled) {
handleCallback(resolve, reject, success, r);
} else {
resolve(r);
}
}, (r) => {
if (this._canceled) {
p.cancel();
}
if (error && !this._canceled) {
handleCallback(resolve, reject, error, r);
} else {
reject(r);
}
});
);
});

@@ -62,0 +65,0 @@ return p;

@@ -6,7 +6,10 @@ "use strict";

});
exports.default = void 0;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var handleCallback = function handleCallback(resolve, reject, callback, r) {

@@ -20,3 +23,5 @@ try {

var CancelablePromise = function () {
var CancelablePromise =
/*#__PURE__*/
function () {
_createClass(CancelablePromise, null, [{

@@ -69,2 +74,3 @@ key: "all",

}
if (success && !_this._canceled) {

@@ -79,2 +85,3 @@ handleCallback(resolve, reject, success, r);

}
if (error && !_this._canceled) {

@@ -98,5 +105,7 @@ handleCallback(resolve, reject, error, r);

this._canceled = true;
if (errorCallback) {
this._promise.catch(errorCallback);
}
return this;

@@ -103,0 +112,0 @@ }

{
"name": "cancelable-promise",
"version": "2.4.1",
"version": "2.5.0",
"description": "A simple cancelable promise",
"main": "dist/CancelablePromise.js",
"jsnext:main": "CancelablePromise.js",
"files": [
"dist/CancelablePromise.js",
"CancelablePromise.js",
"LICENSE",
"README.md"
],
"scripts": {

@@ -20,20 +27,12 @@ "test": "mocha --opts mocha.opts",

},
"browserify": {
"transform": [
"babelify"
]
},
"babel": {
"presets": [
"es2015"
]
},
"homepage": "https://github.com/alkemics/CancelablePromise#readme",
"devDependencies": {
"babel-cli": "~6.16.0",
"babel-core": "~6.17.0",
"babel-preset-es2015": "~6.16.0",
"chai": "~3.5.0",
"mocha": "~3.1.2"
"@babel/cli": "~7.5.0",
"@babel/core": "~7.5.4",
"@babel/preset-env": "~7.5.4",
"@babel/register": "~7.4.4",
"chai": "~4.2.0",
"mocha": "~6.1.4",
"prettier": "~1.18.2"
}
}
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