💬 (Money) Add withPadEnd parameter
This commit is contained in:
@@ -18,13 +18,18 @@ export const money = (
|
||||
|
||||
export const moneypad = (
|
||||
value: number,
|
||||
currency: ICurrency | null | undefined
|
||||
currency?: ICurrency | null,
|
||||
withPadEnd: boolean = true
|
||||
): string => {
|
||||
const m = money(value, currency)
|
||||
const s: string[] = m.split('\xa0')
|
||||
const cur: string | undefined = s.pop()
|
||||
|
||||
return `${s.join('\xa0')}\xa0${(cur || '').padEnd(3, '\xa0')}`
|
||||
const result = `${s.join('\xa0')}\xa0${cur || ''}`
|
||||
if (withPadEnd) {
|
||||
return result.padEnd(3, '\xa0')
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
export const date = (value: string, country: string = 'fr-FR') => {
|
||||
|
||||
Reference in New Issue
Block a user