aboutsummaryrefslogtreecommitdiff
path: root/node_modules/p-finally/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/p-finally/index.js')
-rw-r--r--node_modules/p-finally/index.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/node_modules/p-finally/index.js b/node_modules/p-finally/index.js
new file mode 100644
index 0000000..52b7b49
--- /dev/null
+++ b/node_modules/p-finally/index.js
@@ -0,0 +1,15 @@
+'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;
+ })
+ );
+};