UNPKG

@ministryofjustice/hmpps-digital-prison-reporting-frontend

Version:

The Digital Prison Reporting Frontend contains templates and code to help display data effectively in UI applications.

25 lines (23 loc) 618 B
/** * Maps the measure Unit type to the correct char * * @param {string} unit * @return {*} {string} */ const mapUnitToSymbol = (unit) => { switch (unit) { case 'PERCENTAGE': return '%'; default: return ''; } }; const setUnitOnValue = (value, unit, brackets = true, prefix = false) => { if (unit) { const unitValue = brackets ? ` (${unit})` : unit; return !prefix ? `${value}${unitValue}` : `${unitValue}${value}`; } return `${value}`; }; export { mapUnitToSymbol, setUnitOnValue }; //# sourceMappingURL=VisualisationUnitHelper.js.map