npm.io
2.0.1 • Published 4 months ago

promise-share

Licence
MIT
Version
2.0.1
Deps
1
Size
3 kB
Vulns
0
Weekly
0
Stars
104

promise-share

Creates a getter function for a promise result

npm version

Helps to avoid UnhandledPromiseRejectionWarning. If you need to export a result as a promise, use this function to wrap the promise. When you'll need the result of the promise, run the function.

Installation

<pnpm|yarn|npm> add promise-share

Usage

'use strict'
const promiseShare = require('promise-share')

const file = promiseShare(readFileAsync())

console.log(await file())
//> file content

License

MIT Zoltan Kochan

Keywords