rich-domain
Version:
This package provide utils file and interfaces to assistant build a complex application with domain driving design
22 lines • 1.01 kB
TypeScript
/**
* @description Divides two numbers (`valueA` by `valueB`) with support for validation and normalization.
* Handles edge cases such as non-numeric inputs and applies a specified precision to the result.
*
* @param valueA The dividend (numerator). Can be a number or a value convertible to a number.
* @param valueB The divisor (denominator). Can be a number or a value convertible to a number.
* @param precision The number of decimal places to apply to the result. Defaults to 5.
*
* @returns The result of the division, normalized and adjusted to the specified precision.
* Returns `0` if either value is not a valid number.
*
* @example
* ```typescript
* Divide(10, 2); // Returns 5
* Divide(10, 3, 3); // Returns 3.333
* Divide("10", "2"); // Returns 5 (handles string inputs)
* Divide(NaN, 2); // Returns 0
* ```
*/
export declare const Divide: (valueA: number, valueB: number, precision?: number) => number;
export default Divide;
//# sourceMappingURL=divide-number.util.d.ts.map