promise-make-naked

A simple function that makes a promise that can be resolved, rejected or introspected from the outside.

MIT 8 个版本
安装
npm install promise-make-naked
yarn add promise-make-naked
pnpm add promise-make-naked
bun add promise-make-naked
README

Promise Make Naked

A simple function that makes a promise that can be resolved, rejected or introspected from the outside.

Install

npm install --save promise-make-naked

Usage

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 reason

isPending (); // 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

版本列表
3.0.2 2025-01-11
3.0.1 2025-01-11
3.0.0 2024-06-30
2.1.2 2024-04-04
2.1.1 2023-08-11
2.1.0 2023-08-11
2.0.0 2022-04-07
1.0.0 2021-03-26