index.ts 520 B

12345678910111213141516171819
  1. // @ts-nocheck
  2. /**
  3. * 检查一个值是否为字符串类型
  4. * @param str 要检查的值
  5. * @returns 如果值的类型是字符串类型,则返回 true;否则返回 false
  6. */
  7. // #ifndef UNI-APP-X && APP
  8. // export const isString = (str: unknown): str is string => typeof str === 'string';
  9. export function isString (str: unknown): str is string {
  10. return typeof str == 'string'
  11. }
  12. // #endif
  13. // #ifdef UNI-APP-X && APP
  14. export function isString (str: any|null): boolean {
  15. return typeof str == 'string'
  16. }
  17. // #endif