isPromise
A function that checks whether a given argument is a Promise. If isPromise returns true, the type of the argument is narrowed to Promise.
Code
Interface
typescript
function isPromise<T = any>(value: unknown): value is Promise<T>;
Usage
typescript
import { isPromise } from '@modern-kit/utils';
isPromise(Promise.resolve()); // true
isPromise((async () => {})()); // true
isPromise(() => {}); // false
isPromise('123'); // false
isPromise(true); // false
isPromise({}); // false
isPromise(null); // false