ulthar-framework/packages/fabric/validations/number/is-number.ts

10 lines
241 B
TypeScript

/**
* Checks if a value is a number even if it is a string that can be converted to a number
*/
export function isNumber(value: unknown): value is number {
if (typeof value === "number") {
return !isNaN(value);
}
return false;
}