Skip to content

Commit

Permalink
feat: update isPromise
Browse files Browse the repository at this point in the history
  • Loading branch information
GreatAuk committed Nov 8, 2024
1 parent 25b7c49 commit 3121f34
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/share/src/is.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const isBlob = (val: unknown): val is Blob => toTypeString(val) === 'Blob
* Check if the value is a plain object, that is, the object created by the Object constructor
*/
export const isPlainObject = (val: unknown): val is object => toTypeString(val) === 'Object'
export const isPromise = (val: unknown): val is Promise<any> => toTypeString(val) === 'Promise'
export const isPromise = (val: unknown): val is Promise<any> => toTypeString(val) === 'Promise' || isObject(val) && isFunction(val.then) && isFunction(val.catch)
export function isPrimitive(val: unknown): val is string | number | boolean | symbol | null | undefined {
return ['string', 'number', 'boolean', 'symbol', 'null', 'undefined'].includes(typeof val)
}
Expand Down

0 comments on commit 3121f34

Please sign in to comment.