cxc-szcx-uniapp/uni_modules/lime-shared/isString/index.ts
2025-02-11 17:09:35 +08:00

20 lines
520 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 str 要检查的值
* @returns 如果值的类型是字符串类型,则返回 true否则返回 false
*/
// #ifndef UNI-APP-X && APP
// export const isString = (str: unknown): str is string => typeof str === 'string';
export function isString (str: unknown): str is string {
return typeof str == 'string'
}
// #endif
// #ifdef UNI-APP-X && APP
export function isString (str: any|null): boolean {
return typeof str == 'string'
}
// #endif