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.

28 lines (25 loc) 673 B
'use strict'; /** * 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}`; }; exports.mapUnitToSymbol = mapUnitToSymbol; exports.setUnitOnValue = setUnitOnValue; //# sourceMappingURL=VisualisationUnitHelper.js.map