@shopware-ag/meteor-component-library
Version:
The meteor component library is a Vue component library developed by Shopware. It is based on the [Meteor Design System](https://shopware.design/).
16 lines (15 loc) • 400 B
text/typescript
/**
* Checks if a value is a Promise.
* @param value - The value to check.
* @return True if the value is a Promise, false otherwise.
*/
export function isPromise<T>(value: unknown): value is Promise<T> {
return (
!!value &&
typeof value === "object" &&
"then" in value &&
typeof value.then === "function" &&
"catch" in value &&
typeof value.catch === "function"
);
}