source: trip-planner-front/node_modules/p-finally/readme.md@ 76712b2

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

initial commit

  • Property mode set to 100644
File size: 949 bytes
Line 
1# p-finally [![Build Status](https://travis-ci.org/sindresorhus/p-finally.svg?branch=master)](https://travis-ci.org/sindresorhus/p-finally)
2
3> [`Promise#finally()`](https://github.com/tc39/proposal-promise-finally) [ponyfill](https://ponyfill.com) - Invoked when the promise is settled regardless of outcome
4
5Useful for cleanup.
6
7
8## Install
9
10```
11$ npm install --save p-finally
12```
13
14
15## Usage
16
17```js
18const pFinally = require('p-finally');
19
20const dir = createTempDir();
21
22pFinally(write(dir), () => cleanup(dir));
23```
24
25
26## API
27
28### pFinally(promise, [onFinally])
29
30Returns a `Promise`.
31
32#### onFinally
33
34Type: `Function`
35
36Note: Throwing or returning a rejected promise will reject `promise` with the rejection reason.
37
38
39## Related
40
41- [p-try](https://github.com/sindresorhus/p-try) - `Promise#try()` ponyfill - Starts a promise chain
42- [More…](https://github.com/sindresorhus/promise-fun)
43
44
45## License
46
47MIT © [Sindre Sorhus](https://sindresorhus.com)
Note: See TracBrowser for help on using the repository browser.