es6-promisify
Advanced tools
Comparing version 4.0.0 to 4.1.0
@@ -13,2 +13,14 @@ "use strict"; | ||
/** | ||
* thatLooksLikeAPromiseToMe() | ||
* | ||
* Duck-types a promise. | ||
* | ||
* @param {object} o | ||
* @return {bool} True if this resembles a promise | ||
*/ | ||
function thatLooksLikeAPromiseToMe(o) { | ||
return o && typeof o.then === "function" && typeof o.catch === "function"; | ||
} | ||
/** | ||
* promisify() | ||
@@ -64,3 +76,9 @@ * | ||
// Call the function | ||
original.apply(that, args); | ||
var response = original.apply(that, args); | ||
// If it looks like original already returns a promise, | ||
// then just resolve with that promise. Hopefully, the callback function we added will just be ignored. | ||
if (thatLooksLikeAPromiseToMe(response)) { | ||
resolve(response); | ||
} | ||
}); | ||
@@ -67,0 +85,0 @@ }; |
{ | ||
"name": "es6-promisify", | ||
"version": "4.0.0", | ||
"version": "4.1.0", | ||
"description": "Converts callback-based functions to ES6 Promises", | ||
@@ -14,3 +14,3 @@ "main": "dist/promisify.js", | ||
"dependencies": { | ||
"es6-promise": "^3.1.2" | ||
"es6-promise": "^3.2.1" | ||
}, | ||
@@ -31,8 +31,8 @@ "scripts": { | ||
"devDependencies": { | ||
"babel-preset-es2015": "^6.6.0", | ||
"babel-preset-es2015": "^6.9.0", | ||
"gulp": "^3.9.1", | ||
"gulp-babel": "^6.1.2", | ||
"jslint": "^0.9.6", | ||
"jslint": "^0.10.0", | ||
"nodeunit": "^0.9.1" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
123
5864
3
1
0
Updatedes6-promise@^3.2.1