source: node_modules/es-toolkit/dist/math/round.d.ts

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 794 bytes
Line 
1/**
2 * Rounds a number to a specified precision.
3 *
4 * This function takes a number and an optional precision value, and returns the number rounded
5 * to the specified number of decimal places.
6 *
7 * @param {number} value - The number to round.
8 * @param {number} [precision=0] - The number of decimal places to round to. Defaults to 0.
9 * @returns {number} The rounded number.
10 * @throws {Error} Throws an error if `Precision` is not integer.
11 *
12 * @example
13 * const result1 = round(1.2345); // result1 will be 1
14 * const result2 = round(1.2345, 2); // result2 will be 1.23
15 * const result3 = round(1.2345, 3); // result3 will be 1.235
16 * const result4 = round(1.2345, 3.1); // This will throw an error
17 */
18declare function round(value: number, precision?: number): number;
19
20export { round };
Note: See TracBrowser for help on using the repository browser.