合同小程序前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
920 B

  1. // @ts-nocheck
  2. /**
  3. *
  4. * @param value number string
  5. * @returns NaN true false
  6. */
  7. // #ifndef UNI-APP-X
  8. export function isNumber(value: number | string | null): boolean {
  9. return typeof value === 'number' && !isNaN(value);
  10. }
  11. // #endif
  12. // #ifdef UNI-APP-X
  13. export function isNumber(value: any|null): boolean {
  14. // #ifdef APP-ANDROID
  15. return ['Byte', 'UByte','Short','UShort','Int','UInt','Long','ULong','Float','Double','number'].includes(typeof value)
  16. // #endif
  17. // #ifdef APP-IOS
  18. return ['Int8', 'UInt8','Int16','UInt16','Int32','UInt32','Int64','UInt64','Int','UInt','Float','Float16','Float32','Float64','Double', 'number'].includes(typeof value)
  19. // #endif
  20. // #ifndef UNI-APP-X && APP
  21. return typeof value === 'number' && !isNaN(value);
  22. // #endif
  23. }
  24. // #endif