Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including promise-status-async with all npm packages installed. Try it out:

const { PromiseStatuses, PROMISE_RESOLVED, promiseStatus, promiseState, isPromiseResolved, isPromiseNotRejected } = require('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 })();

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

promise-status-async v1.2.10

Promise status management tool

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free