mirror of
https://github.com/peakoss/anti-slop
synced 2026-12-01 13:39:13 +08:00
refactor(input): switch to Number.isNaN to avoid type coercion
This commit is contained in:
1 file changed
+1
-1
+1
-1
@@ -141,7 +141,7 @@ export function getSettings(): Settings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function validateNumber(value: number, name: string, min: number, max: number): void {
|
function validateNumber(value: number, name: string, min: number, max: number): void {
|
||||||
if (isNaN(value)) {
|
if (Number.isNaN(value)) {
|
||||||
throw new Error(`"${name}" must be a valid number`);
|
throw new Error(`"${name}" must be a valid number`);
|
||||||
}
|
}
|
||||||
if (value < min || value > max) {
|
if (value < min || value > max) {
|
||||||
|
|||||||
Reference in new issue
Block a user