Skip to main content

Function: roundNumber()

roundNumber(num: string | number, scale: number): number

Properly rounds up or down a number. Also supports strings using an exponent to indicate large or small numbers.

Parameters

ParameterTypeDefault valueDescription
numstring | numberundefinedThe number to round off
scalenumber0The amount of decimals to retain

Returns

number

Source

lib/roundNumber.ts:7