@braintree/wrap-promise
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -1,19 +0,23 @@ | ||
CHANGELOG | ||
========= | ||
# CHANGELOG | ||
# 2.1.0 | ||
- Add typescript types | ||
# 2.0.0 | ||
*Breaking Changes* | ||
* Errors that are thrown in callback functions are now logged to the console (#4) | ||
_Breaking Changes_ | ||
- Errors that are thrown in callback functions are now logged to the console (#4) | ||
# 1.1.1 | ||
* Publish to npm as scoped package | ||
- Publish to npm as scoped package | ||
# 1.1.0 | ||
* Add wrap-prototype function for wrapping all methods on a prototype | ||
- Add wrap-prototype function for wrapping all methods on a prototype | ||
# 1.0.0 | ||
* Initial release | ||
- Initial release |
{ | ||
"name": "@braintree/wrap-promise", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "A small lib to return promises or use callbacks", | ||
"main": "wrap-promise.js", | ||
"main": "dist/wrap-promise.js", | ||
"types": "dist/wrap-promise.d.ts", | ||
"files": [ | ||
"wrap-promise", | ||
"lib/*" | ||
"dist" | ||
], | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"chai": "^4.2.0", | ||
"eslint": "^5.16.0", | ||
"eslint-config-braintree": "^2.0.0", | ||
"mocha": "^6.1.2", | ||
"sinon": "^7.3.1", | ||
"sinon-chai": "^3.3.0" | ||
"@types/jest": "^25.2.1", | ||
"eslint": "^6.8.0", | ||
"eslint-config-braintree": "5.0.0-typescript-prep-rc.17", | ||
"jest": "^25.3.0", | ||
"prettier": "^2.0.4", | ||
"ts-jest": "^25.3.1", | ||
"typescript": "^3.8.3" | ||
}, | ||
"scripts": { | ||
"lint": "eslint .", | ||
"pretest": "npm run lint", | ||
"test": "mocha" | ||
"prepublishOnly": "npm run build", | ||
"prebuild": "prettier --write .", | ||
"build": "tsc --declaration", | ||
"lint": "eslint --ext .js,.ts .", | ||
"posttest": "npm run lint", | ||
"test": "jest" | ||
}, | ||
@@ -24,0 +28,0 @@ "repository": { |
@@ -9,5 +9,5 @@ # wrap-promise | ||
// my-method.js | ||
var wrapPromise = require('wrap-promise'); | ||
var wrapPromise = require("wrap-promise"); | ||
function myMethod (arg) { | ||
function myMethod(arg) { | ||
return new Promise(function (resolve, reject) { | ||
@@ -28,11 +28,13 @@ doSomethingAsync(arg, function (err, response) { | ||
// my-app.js | ||
var myMethod = require('./my-method'); | ||
var myMethod = require("./my-method"); | ||
myMethod('foo').then(function (response) { | ||
// do something with response | ||
}).catch(function (err) { | ||
// handle error | ||
}); | ||
myMethod("foo") | ||
.then(function (response) { | ||
// do something with response | ||
}) | ||
.catch(function (err) { | ||
// handle error | ||
}); | ||
myMethod('foo', function (err, response) { | ||
myMethod("foo", function (err, response) { | ||
if (err) { | ||
@@ -53,3 +55,3 @@ // handle error | ||
MyObject.prototype.myAsyncMethod = function () { | ||
return new Promise (function (resolve, reject) { | ||
return new Promise(function (resolve, reject) { | ||
// | ||
@@ -60,3 +62,3 @@ }); | ||
MyObject.prototype.myOtherAsyncMethod = function () { | ||
return new Promise (function (resolve, reject) { | ||
return new Promise(function (resolve, reject) { | ||
// | ||
@@ -75,3 +77,3 @@ }); | ||
module.exports = wrapPromise.wrapPrototype(MyObject, { | ||
ignoreMethods: ['myMethodOnThePrototypeIDoNotWantTransformed'] | ||
ignoreMethods: ["myMethodOnThePrototypeIDoNotWantTransformed"], | ||
}); | ||
@@ -84,4 +86,4 @@ ``` | ||
module.exports = wrapPromise.wrapPrototype(MyObject, { | ||
transformPrivateMethods: true | ||
transformPrivateMethods: true, | ||
}); | ||
``` |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
8456
12
112
84
7
1