From e89ce6b57aa92474c22906e0dd6669fafb60dbd3 Mon Sep 17 00:00:00 2001 From: ShaneK Date: Thu, 6 Mar 2025 12:14:54 -0800 Subject: [PATCH] chore(helpers): moving type safety check to helpers file --- core/src/utils/floating-point/index.ts | 2 +- core/src/utils/helpers.ts | 7 +++++++ core/src/utils/type-guards.ts | 6 ------ 3 files changed, 8 insertions(+), 7 deletions(-) delete mode 100644 core/src/utils/type-guards.ts diff --git a/core/src/utils/floating-point/index.ts b/core/src/utils/floating-point/index.ts index 1e25ea3719..1ece5510c8 100644 --- a/core/src/utils/floating-point/index.ts +++ b/core/src/utils/floating-point/index.ts @@ -1,4 +1,4 @@ -import { isSafeNumber } from '../type-guards.ts'; +import { isSafeNumber } from "@utils/helpers"; export function getDecimalPlaces(n: number) { if (!isSafeNumber(n)) return 0; diff --git a/core/src/utils/helpers.ts b/core/src/utils/helpers.ts index a740ff98ac..a005686b77 100644 --- a/core/src/utils/helpers.ts +++ b/core/src/utils/helpers.ts @@ -424,3 +424,10 @@ export const getNextSiblingOfType = (element: Element): T | n } return null; }; + +/** + * Checks input for usable number. Not NaN and not Infinite. + */ +export const isSafeNumber = (input: unknown): input is number => { + return typeof input === 'number' && !isNaN(input) && isFinite(input); +}; diff --git a/core/src/utils/type-guards.ts b/core/src/utils/type-guards.ts deleted file mode 100644 index e5ea629954..0000000000 --- a/core/src/utils/type-guards.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Checks input for usable number. Not NaN and not Infinite. - */ -export const isSafeNumber = (input: unknown): input is number => { - return typeof input === 'number' && !isNaN(input) && isFinite(input); -};