UNPKG

@polkadot/util

Version:
12 lines (11 loc) 422 B
import { bnToBn } from '../bn/toBn.js'; import { formatDecimal } from './formatDecimal.js'; import { getSeparator } from './getSeparator.js'; /** * @name formatNumber * @description Formats a number into string format with thousand separators */ export function formatNumber(value, { locale = 'en' } = {}) { const { thousand } = getSeparator(locale); return formatDecimal(bnToBn(value).toString(), thousand); }