@lion/localize
Version:
The localization system helps to manage localization data split into locales and automate its loading
22 lines (21 loc) • 837 B
JavaScript
/**
* For Dutch and Belgian amounts the currency should be at the end of the string
*
* @typedef {import('../../../../types/LocalizeMixinTypes').FormatNumberPart} FormatNumberPart
* @param {FormatNumberPart[]} formattedParts
* @returns {FormatNumberPart[]}
*/
export function forceCurrencyToEnd(formattedParts) {
if (formattedParts[0].type === 'currency') {
const moveCur = formattedParts.splice(0, 1);
const moveLit = formattedParts.splice(0, 1);
formattedParts.push(moveLit[0]);
formattedParts.push(moveCur[0]);
} else if (formattedParts[0].type === 'minusSign' && formattedParts[1].type === 'currency') {
const moveCur = formattedParts.splice(1, 1);
const moveLit = formattedParts.splice(1, 1);
formattedParts.push(moveLit[0]);
formattedParts.push(moveCur[0]);
}
return formattedParts;
}