cxc-szcx-uniapp/uni_modules/lime-shared/isNumber/index.ts

26 lines
926 B
TypeScript
Raw Normal View History

2024-12-04 03:10:13 +00:00
// @ts-nocheck
/**
*
* @param value number string
* @returns NaN true false
*/
// #ifndef UNI-APP-X
export function isNumber(value: number | string | null): boolean {
return typeof value === 'number' && !isNaN(value);
}
// #endif
// #ifdef UNI-APP-X
export function isNumber(value: any|null): boolean {
// #ifdef APP-ANDROID
return ['Byte', 'UByte','Short','UShort','Int','UInt','Long','ULong','Float','Double','number'].includes(typeof value)
// #endif
// #ifdef APP-IOS
return ['Int8', 'UInt8','Int16','UInt16','Int32','UInt32','Int64','UInt64','Int','UInt','Float','Float16','Float32','Float64','Double', 'number'].includes(typeof value)
// #endif
// #ifndef APP-ANDROID || APP-IOS
return typeof value === 'number' && !isNaN(value);
// #endif
}
// #endif