function formatValue(
value,
{
roundingMode = DECIMAL,
trailingZeroes = false,
unit = "",
spaceBeforeUnit = !checkIsUnitPercent(unit),
useNoBreakSpace = false,
showPlus = false,
numDecimalPlaces = 2,
numSignificantFigures = 3,
numberAbbreviation = "long"
} = {}
) {
const formatter = createFormatter(unit);
const specifier = new d3.FormatSpecifier({
zero: "0",
trim: getTrim({
roundingMode,
trailingZeroes
}),
sign: getSign({ showPlus }),
symbol: getSymbol({ unit }),
comma: ",",
precision: getPrecision({
roundingMode,
value,
numDecimalPlaces,
numSignificantFigures,
type: getType({ roundingMode, numberAbbreviation, value, unit })
}),
type: getType({ roundingMode, numberAbbreviation, value, unit })
}).toString();
const formattedString = formatter(specifier)(value);
const postprocessedString = postprocessString({
string: formattedString,
roundingMode,
numberAbbreviation,
spaceBeforeUnit,
useNoBreakSpace,
unit,
value,
numDecimalPlaces
});
return [postprocessedString];
}