source: trip-planner-front/node_modules/p-finally/index.js@ fa375fe

Last change on this file since fa375fe was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 302 bytes
Line 
1'use strict';
2module.exports = (promise, onFinally) => {
3 onFinally = onFinally || (() => {});
4
5 return promise.then(
6 val => new Promise(resolve => {
7 resolve(onFinally());
8 }).then(() => val),
9 err => new Promise(resolve => {
10 resolve(onFinally());
11 }).then(() => {
12 throw err;
13 })
14 );
15};
Note: See TracBrowser for help on using the repository browser.