cxc-szcx-uniapp/uni_modules/lime-shared/isFunction/index.ts
2024-09-14 10:26:50 +08:00

17 lines
432 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// @ts-nocheck
/**
* 检查一个值是否为函数类型
* @param val 要检查的值
* @returns 如果值的类型是函数类型,则返回 true否则返回 false
*/
// #ifdef APP-IOS || APP-ANDROID
export const isFunction = (val: any):boolean => typeof val == 'function';
// #endif
// #ifndef APP-IOS || APP-ANDROID
export const isFunction = (val: unknown): val is Function =>
typeof val === 'function';
// #endif