utils.prettybytes.options.maximumfractiondigits
Home > @nipem/utils > PrettyBytes > Options > maximumFractionDigits
PrettyBytes.Options.maximumFractionDigits property
The maximum number of fraction digits to display.
If neither minimumFractionDigits
or maximumFractionDigits
are set, the default behavior is to round to 3 significant digits.
readonly maximumFractionDigits?: number;
Example
import { prettyBytes } from '@nipem/utils';
// Show the number with at most 1 fractional digit
P(1920, {maximumFractionDigits: 1});
//=> '1.9 kB'
P(1920);
//=> '1.92 kB'