ts-humanize / computeSI
computeSI(
input,roundTo?): [number,SI_PREFIXES]
Defined in: SI-Units/SI.ts:20
Finds the most appropriate SI prefix for the given number and returns the prefix along with the value adjusted to be within that prefix
Will round to a maximum of roundTo decimal places (default: 6).
See also: SI, parseSI
number
number = 6
Number of decimal places to round to (default: 6)
[number, SI_PREFIXES]
computeSI(2.2345e-12) // [2.2345, "p"]
computeSI(1234567, 2) // [1.23, "M"]