predictype / predicates/promises / promiseType
promiseType(
source
,oper
):boolean
Defined in: predicates/promises/promiseType.ts:24
Checks if a value is a Promise or an async function using the specified operation.
unknown
The value to check.
The type operation to perform (e.g. ‘is_promise’, ‘is_async_function’).
boolean
True if the type check is valid according to the operator, otherwise false.
If the operation is not recognized.
const p = Promise.resolve(42);
async function foo() {}
promiseType(p, 'is_promise'); // true
promiseType(foo, 'is_async_function'); // true
Supported Operators: