Promise.prototype.finally = function (cb) {
const res = () => this;
return this.then(value =>
Promise.resolve(cb({state: "fulfilled", value})).then(res)
, reason =>
Promise.resolve(cb({state: "rejected", reason})).then(res)
);
};
Created
January 18, 2019 09:17
-
-
Save ramingar/cd4717b20baa23d547b6782706b1c961 to your computer and use it in GitHub Desktop.
Finally polyfill para versiones de node antiguas #node #finally #polyfill
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment