1.2.10 • Published 3 years ago

promise-status-async v1.2.10

Weekly downloads
483
License
MIT
Repository
github
Last release
3 years ago

promise-status-async

Promise status management tool

Install

npm install promise-status-async

API

Follow promise-status-async API for more details.

Usage example

import {
    PromiseStatuses,
    PROMISE_RESOLVED,
    promiseStatus,
    promiseState,
    isPromiseResolved,
    isPromiseNotRejected
} from 'promise-status-async';

const pendingPromise = new Promise(() => {});
const resolvedPromise = Promise.resolve('some value');
const rejectedPromise = Promise.reject('some reason');

(async function usageExample () {
    console.log(await promiseStatus(pendingPromise));
    // pending

    console.log(await promiseStatus(rejectedPromise) === PromiseStatuses.PROMISE_REJECTED);
    // true

    console.log(await promiseStatus(resolvedPromise) === PROMISE_RESOLVED);
    // true

    console.log(await promiseState(resolvedPromise));
    // {status: "resolved", value: "some value"}

    console.log(await isPromiseResolved(pendingPromise));
    // false

    console.log(await isPromiseNotRejected(resolvedPromise));
    // true
})();
1.2.10

3 years ago

1.2.0

3 years ago

1.2.8

3 years ago

1.2.7

3 years ago

1.2.6

3 years ago

1.2.4

3 years ago

1.2.3

3 years ago

1.2.9

3 years ago

1.1.11

4 years ago

1.1.10

4 years ago

1.1.9

5 years ago

1.1.8

5 years ago

1.1.7

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.0.0

6 years ago