chore: improve utils typing and naming

This commit is contained in:
陈嘉涵
2020-01-19 19:05:07 +08:00
parent 8345d6e126
commit 77756f30e6
5 changed files with 25 additions and 23 deletions
+5 -5
View File
@@ -1,12 +1,12 @@
export function isNumber(value: string): boolean {
return /^\d+(\.\d+)?$/.test(value);
export function isNumeric(val: string): boolean {
return /^\d+(\.\d+)?$/.test(val);
}
export function isNaN(value: any): boolean {
export function isNaN(val: number): val is typeof NaN {
if (Number.isNaN) {
return Number.isNaN(value);
return Number.isNaN(val);
}
// eslint-disable-next-line no-self-compare
return value !== value;
return val !== val;
}