logo

Promise

This is a collection of functions for working with promises.

Check if an unknown value is a Promise

The isPromise function checks if an unknown value is a Promise.

import { isPromise } from '@aracna/core';

// will log true
console.log(isPromise(Promise.resolve()));

Check if an unknown value is PromiseLike

The isPromiseLike function checks if an unknown value is PromiseLike.

import { noop, isPromiseLike } from '@aracna/core';

// will log true
console.log(isPromiseLike(Promise.resolve()));

// will log true
console.log(isPromiseLike({ then: noop }));