Comparing version
@@ -7,6 +7,5 @@ 'use strict'; | ||
) => { | ||
let value; | ||
try { | ||
const value = await promise; | ||
await onFinally(); | ||
return value; | ||
value = await promise; | ||
} catch (error) { | ||
@@ -16,2 +15,5 @@ await onFinally(); | ||
} | ||
await onFinally(); | ||
return value; | ||
}; |
{ | ||
"name": "p-finally", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "`Promise#finally()` ponyfill - Invoked when the promise is settled regardless of outcome", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -20,3 +20,3 @@ # p-finally [](https://travis-ci.org/sindresorhus/p-finally) | ||
const directory = createTempDir(); | ||
const directory = createTempDirectory(); | ||
@@ -33,3 +33,3 @@ (async () => { | ||
### pFinally(promise, [onFinally]) | ||
### pFinally(promise, onFinally?) | ||
@@ -49,1 +49,14 @@ Returns a `Promise`. | ||
- [More…](https://github.com/sindresorhus/promise-fun) | ||
--- | ||
<div align="center"> | ||
<b> | ||
<a href="https://tidelift.com/subscription/pkg/npm-p-finally?utm_source=npm-p-finally&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a> | ||
</b> | ||
<br> | ||
<sub> | ||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies. | ||
</sub> | ||
</div> |
3365
15.32%15
7.14%60
27.66%