Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fabiospampinato/promise-make-naked
A simple function that makes a promise that can be resolved or rejected from the outside.
https://github.com/fabiospampinato/promise-make-naked
naked promise
Last synced: 22 days ago
JSON representation
A simple function that makes a promise that can be resolved or rejected from the outside.
- Host: GitHub
- URL: https://github.com/fabiospampinato/promise-make-naked
- Owner: fabiospampinato
- License: mit
- Created: 2021-03-26T15:43:07.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-06-30T15:30:11.000Z (6 months ago)
- Last Synced: 2024-08-09T22:52:14.793Z (5 months ago)
- Topics: naked, promise
- Language: JavaScript
- Size: 13.7 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# Promise Make Naked
A simple function that makes a promise that can be resolved, rejected or introspected from the outside.
## Install
```sh
npm install --save promise-make-naked
```## Usage
```ts
import makeNakedPromise from 'promise-make-naked';// Let's create a naked Promise
const {promise, resolve, reject, isPending, isResolved, isRejected} = makeNakedPromise ();
resolve ( 123 ); // Resolve the promise with the provided value
reject ( new Error () ); // Reject the promise with the provided reasonisPending (); // Check if the promise is still pending
isResolved (); // Check if the promise got resolved
isRejected (); // Check if the promise got rejected
```## License
MIT © Fabio Spampinato