install-nix-action/node_modules/p-finally/index.js
Domen Kožar 08403cd828
v5
2019-11-13 17:14:48 +01:00

16 lines
302 B
JavaScript

'use strict';
module.exports = (promise, onFinally) => {
onFinally = onFinally || (() => {});
return promise.then(
val => new Promise(resolve => {
resolve(onFinally());
}).then(() => val),
err => new Promise(resolve => {
resolve(onFinally());
}).then(() => {
throw err;
})
);
};