Create type-guards.ts

This commit is contained in:
fudom
2024-12-10 12:19:11 +01:00
committed by GitHub
parent e101f2e022
commit 9717acb7bb

View 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);
};