rich-domain
Version:
This package provide utils file and interfaces to assistant build a complex application with domain driving design
19 lines • 852 B
TypeScript
/**
* @description Adjusts a number or numeric string to a specified precision. The function ensures that the
* result maintains the desired level of precision, handling both integer and decimal parts appropriately.
*
* @param value The input value to be adjusted. Can be a number or a numeric string.
* @param precision The desired number of decimal places in the result.
*
* @returns A number rounded to the specified precision. If the input is a string, it is parsed and adjusted accordingly.
*
* @example
* ```typescript
* ToPrecision(123.456789, 2); // Returns 123.46
* ToPrecision("987.654321", 3); // Returns 987.654
* ToPrecision(10.5, 1); // Returns 10.5
* ```
*/
export declare const ToPrecision: (value: number | string, precision: number) => number;
export default ToPrecision;
//# sourceMappingURL=to-precision.util.d.ts.map