Function: isPromise()
isPromise(
target):boolean
Tell whether a value is a real promise: an instance of Promise (or of a subclass), or a native promise of another realm (a node:vm context, a worker's message). A thenable which is not a promise (an object with a then method) is not one: test it with isPromiseLike. An async function is not a promise, the promise it returns is.
Parameters
target
any
The value to test, of any type.
Returns
boolean
true when the value is a promise, false otherwise (null and undefined included).
Example
typescript
import {isPromise} from 'lakutata/utils'
console.log(isPromise(Promise.resolve(1)), isPromise({then: (): void => undefined}), isPromise(1))
//true false false