Useful methods to deal with numbers.
Formats a given number to a localized string.
It requires two arguments: number and locale. You can also pass in a third argument to set up the decimal length.
import { numberFormat } from '@jsweb/utils/modules/number' const number = 1234567.89 const br = numberFormat(number, 'pt-BR') // 1.234.568 const en = numberFormat(number, 'en-US') // 1,234,568 const fr = numberFormat(number, 'fr-FR') // 1 234 568 const decimals = numberFormat(number, 'pt-BR', 2) // 1.234.567,89
There was an error while loading. Please reload this page.