mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
chore(helpers): moving type safety check to helpers file
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -424,3 +424,10 @@ export const getNextSiblingOfType = <T extends Element>(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);
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
Reference in New Issue
Block a user