UNPKG

rich-domain

Version:

This package provide utils file and interfaces to assistant build a complex application with domain driving design

21 lines 780 B
/** * @description Normalizes a value into a floating-point number (`float`). * If the value is a string representation of a number, it parses it into a `float`. * If the value is already a number, it returns the value as is. * If the value is invalid (`NaN` or non-numeric), it returns `0`. * * @param value The input value to normalize. Can be a string or a number. * * @returns A floating-point number representation of the input, or `0` if the input is invalid. * * @example * ```typescript * Float("123.45"); // Returns 123.45 * Float(678.90); // Returns 678.9 * Float("invalid"); // Returns 0 * Float(NaN); // Returns 0 * ``` */ export declare const Float: (value: number) => number; export default Float; //# sourceMappingURL=normalize-number.util.d.ts.map