Current Folder
This commit is contained in:
1 parent
8b3382289b
commit
cfcada880d
4379 files changed
No files matched your search
+15
@@ -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;
|
||||
})
|
||||
);
|
||||
};
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"name": "p-finally",
|
||||
"version": "1.0.0",
|
||||
"description": "`Promise#finally()` ponyfill - Invoked when the promise is settled regardless of outcome",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/p-finally",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"promise",
|
||||
"finally",
|
||||
"handler",
|
||||
"function",
|
||||
"async",
|
||||
"await",
|
||||
"promises",
|
||||
"settled",
|
||||
"ponyfill",
|
||||
"polyfill",
|
||||
"shim",
|
||||
"bluebird"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
},
|
||||
"xo": {
|
||||
"esnext": true
|
||||
}
|
||||
|
||||
,"_resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz"
|
||||
,"_integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4="
|
||||
,"_from": "p-finally@^1.0.0"
|
||||
}
|
||||
Reference in new issue
Block a user