Comparing version 1.3.0 to 1.3.1
{ | ||
"name": "extes", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "A tiny library that extends native js with some handy tools", | ||
@@ -5,0 +5,0 @@ "main": "index.mjs", |
@@ -10,24 +10,9 @@ /** | ||
Promise.prototype.then = function(...args) { | ||
const next_promise = _PROMISE_THEN.call(this, ...args); | ||
Object.assign(next_promise, this); | ||
delete this._prev; | ||
Object.defineProperty(next_promise, '_prev', {value:this}); | ||
return next_promise; | ||
return DecorateChainedPromise(_PROMISE_THEN.call(this, ...args), this); | ||
}; | ||
Promise.prototype.catch = function(...args) { | ||
const next_promise = _PROMISE_CATCH.call(this, ...args); | ||
Object.assign(next_promise, this); | ||
delete this._prev; | ||
Object.defineProperty(next_promise, '_prev', {value:this}); | ||
return next_promise; | ||
return DecorateChainedPromise(_PROMISE_CATCH.call(this, ...args), this); | ||
}; | ||
Promise.prototype.finally = function(...args) { | ||
const next_promise = _PROMISE_FINALLY.call(this, ...args); | ||
Object.assign(next_promise, this); | ||
delete this._prev; | ||
Object.defineProperty(next_promise, '_prev', {value:this}); | ||
return next_promise; | ||
return DecorateChainedPromise(_PROMISE_FINALLY.call(this, ...args), this); | ||
}; | ||
@@ -88,1 +73,8 @@ | ||
} | ||
function DecorateChainedPromise(next_promise, previous) { | ||
Object.assign(next_promise, previous); | ||
delete next_promise._prev; | ||
Object.defineProperty(next_promise, '_prev', {value:previous}); | ||
return next_promise; | ||
} |
20700
677