@js-bits/xpromise
Advanced tools
Comparing version 0.1.1 to 0.1.2
10
index.js
@@ -46,5 +46,3 @@ import enumerate from '@js-bits/enumerate'; | ||
if (this[ø.executor]) { | ||
const resolve = this.resolve.bind(this); | ||
const reject = this.reject.bind(this); | ||
this[ø.executor](resolve, reject, ...args); | ||
this[ø.executor](this.resolve.bind(this), this.reject.bind(this), ...args); | ||
this[ø.executor] = undefined; | ||
@@ -61,3 +59,3 @@ } | ||
this[ø.resolve](...args); | ||
return this; | ||
// return this; // don't do this | ||
} | ||
@@ -71,3 +69,5 @@ | ||
this[ø.reject](...args); | ||
return this; | ||
// returning anything can lead to a subsequent exceptions | ||
// for cases like promise.catch(xpromise.reject.bind(xpromise)) | ||
// return this; // don't do this | ||
} | ||
@@ -74,0 +74,0 @@ } |
@@ -83,4 +83,4 @@ /* eslint-disable max-classes-per-file */ | ||
}); | ||
test('should return the promise', () => { | ||
expect(promise.resolve(123)).toBe(promise); | ||
test('should return nothing', () => { | ||
expect(promise.resolve(123)).toBeUndefined(); | ||
}); | ||
@@ -112,5 +112,5 @@ }); | ||
}); | ||
test('should return the promise', () => { | ||
test('should return nothing', () => { | ||
promise.catch(() => {}); | ||
expect(promise.reject(123)).toBe(promise); | ||
expect(promise.reject(123)).toBeUndefined(); | ||
}); | ||
@@ -117,0 +117,0 @@ }); |
{ | ||
"name": "@js-bits/xpromise", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Extendable Promise", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
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
9945