promise-share
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i promise-share

Weekly Downloads

5,183

Version

1.0.0

License

MIT

Unpacked Size

2.81 kB

Total Files

5

Last publish

Collaborators

  • zkochan