2024-04-28 10:10:03 +08:00

9 lines
371 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 value 要检查的值,可以是 string 类型或 number 类型
* @returns 如果值是数字类型或表示数字的字符串,则返回 true否则返回 false
*/
export function isNumeric(value: string | number): boolean {
return /^(-)?\d+(\.\d+)?$/.test(value);
}