mirror of
https://github.com/youzan/vant.git
synced 2025-10-21 03:11:15 +00:00
chore: add isPromise utils
This commit is contained in:
@@ -19,6 +19,10 @@ export function isObject(val: any): val is Record<any, any> {
|
||||
return val !== null && typeof val === 'object';
|
||||
}
|
||||
|
||||
export function isPromise<T = any>(val: unknown): val is Promise<T> {
|
||||
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
||||
}
|
||||
|
||||
export function get(object: any, path: string): any {
|
||||
const keys = path.split('.');
|
||||
let result = object;
|
||||
|
Reference in New Issue
Block a user