UNPKG

@dnb/eufemia

Version:

DNB Eufemia Design System UI Library

31 lines 779 B
export const currencyPositionFormatter = (existingFormatter, callback, position = null) => { let count = 0; let countCurrency = -1; return item => { if (typeof existingFormatter === 'function') { item = existingFormatter(item); } count++; switch (item.type) { case 'currency': { if (position === 'after' || position === 'before' && count > 2) { countCurrency = count; callback(item); item.value = ''; } return item; } case 'literal': { if (count === countCurrency + 1) { item.value = ''; } return item; } default: return item; } }; }; //# sourceMappingURL=currencyPosition.js.map