We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fcefceb commit e89ce6bCopy full SHA for e89ce6b
core/src/utils/floating-point/index.ts
@@ -1,4 +1,4 @@
1
-import { isSafeNumber } from '../type-guards.ts';
+import { isSafeNumber } from "@utils/helpers";
2
3
export function getDecimalPlaces(n: number) {
4
if (!isSafeNumber(n)) return 0;
core/src/utils/helpers.ts
@@ -424,3 +424,10 @@ export const getNextSiblingOfType = <T extends Element>(element: Element): T | n
424
}
425
return null;
426
};
427
+
428
+/**
429
+ * Checks input for usable number. Not NaN and not Infinite.
430
+ */
431
+export const isSafeNumber = (input: unknown): input is number => {
432
+ return typeof input === 'number' && !isNaN(input) && isFinite(input);
433
+};
core/src/utils/type-guards.ts
0 commit comments