mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
Create type-guards.ts
This commit is contained in:
6
core/src/utils/type-guards.ts
Normal file
6
core/src/utils/type-guards.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* 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