import { Money } from "bigint-money/dist" ; export class NumberFormatter { readonly locale = 'nl-NL' ; public formatMoney ( amount , maximumDigits = 2 ) { return this . formatMoneyFromNumber ( parseFloat ( amount . toFixed ( 2 ) ) , amount . currency , maximumDigits ) ; } public formatMoneyFromNumber ( amount , currency , maximumDigits = 2 ) { const formatter = new Intl . NumberFormat ( this . locale , { style : 'currency' , minimumFractionDigits : maximumDigits , maximumFractionDigits : maximumDigits , currency : currency } ) ; return formatter . format ( amount ) ; } public formatPercentage ( fraction , maximumDigits = 2 ) { const formatter = new Intl . NumberFormat ( this . locale , { style : 'percent' , maximumFractionDigits : maximumDigits } ) ; return formatter . format ( fraction ) ; } }