From 6a7453b9ec3ae75e11349181b28117ff00c26b99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mustafa=20Ate=C5=9F=20UZUN?= Date: Fri, 11 Aug 2023 14:08:17 +0300 Subject: [PATCH 1/2] isInteger function refactoring --- lib/utils/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/utils/index.ts b/lib/utils/index.ts index 46bf21619..87ef71c16 100644 --- a/lib/utils/index.ts +++ b/lib/utils/index.ts @@ -80,7 +80,7 @@ export function wrapMultiResult(arr: unknown[] | null): unknown[][] | null { */ export function isInt(value: any): value is string { const x = parseFloat(value); - return !isNaN(value) && (x | 0) === x; + return Number.isInteger(x); } /** From 6af7ebbefa2246c20464866159828da8539815a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mustafa=20Ate=C5=9F=20UZUN?= Date: Fri, 11 Aug 2023 17:05:00 +0300 Subject: [PATCH 2/2] parseFloat to Number --- lib/utils/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/utils/index.ts b/lib/utils/index.ts index 87ef71c16..34d442648 100644 --- a/lib/utils/index.ts +++ b/lib/utils/index.ts @@ -79,7 +79,7 @@ export function wrapMultiResult(arr: unknown[] | null): unknown[][] | null { * ``` */ export function isInt(value: any): value is string { - const x = parseFloat(value); + const x = Number(value); return Number.isInteger(x); }