🐛 (moneypad) fix and make the multi currency works!

This commit is contained in:
Julien Calixte
2020-03-15 17:26:35 +01:00
parent cab5a4e46d
commit 99bdcff0ef
3 changed files with 7 additions and 20 deletions

View File

@@ -23,12 +23,13 @@ export const moneypad = (
): string => {
const m = money(value, currency)
const s: string[] = m.split('\xa0')
const cur: string | undefined = s.pop()
let cur: string | undefined = s.pop()
if (withPadEnd) {
cur = (cur || '').padEnd(3, '\xa0')
}
const result = `${s.join('\xa0')}\xa0${cur || ''}`
if (withPadEnd) {
return result.padEnd(3, '\xa0')
}
return result
}