Truncates a number such that is will at a max have 6 (customizable) characters including suffix, decimal point, or comma.
Default suffixes are in defaultTruncationSuffixes:
'k', // thousand 'M', // million 'B', // billion 'T', // trillion 'P', // peta-, quadrillion 'E', // exa- quintillion 'Z', // zetta- sextillion 'Y', // yotta- septillion
import {truncateNumber} from '@augment-vir/common';// `result` will be `'1M'`const result = truncateNumber(1_000_000); Copy
import {truncateNumber} from '@augment-vir/common';// `result` will be `'1M'`const result = truncateNumber(1_000_000);
@augment-vir/common
Truncates a number such that is will at a max have 6 (customizable) characters including suffix, decimal point, or comma.
Default suffixes are in defaultTruncationSuffixes: