aswi2020vldc-gitlab/templetes/node_modules/p-finally/index.js @ 0b434236
1 |
'use strict'; |
---|---|
2 |
module.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 |
};
|