UNPKG

345 BJavaScriptView Raw
1'use strict';
2
3var Promise = require('./core.js');
4
5module.exports = Promise;
6Promise.prototype.finally = function (f) {
7 return this.then(function (value) {
8 return Promise.resolve(f()).then(function () {
9 return value;
10 });
11 }, function (err) {
12 return Promise.resolve(f()).then(function () {
13 throw err;
14 });
15 });
16};