UNPKG

@augment-vir/common

Version:

A collection of augments, helpers types, functions, and classes for any JavaScript environment.

24 lines (23 loc) 718 B
/** * Round a value to the given number of decimal digits. If no decimal value is present, or if * `undefined` digits are given, no rounding occurs. * * @category Number * @category Package : @augment-vir/common * @example * * ```ts * import {round} from '@augment-vir/common'; * * // `result1` is `5.13` * const result1 = round(5.125, {digits: 2}); * // `result2` is `5` * const result2 = round(25, {digits: 2}); * ``` * * @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common) */ export declare function round(value: number, { digits, }: { /** The number of digits to round to. Set to `undefined` to disable rounding. */ digits: number | undefined; }): number;