mirror of
https://github.com/pezkuwichain/pezkuwi-common.git
synced 2026-04-22 05:38:03 +00:00
12 lines
422 B
JavaScript
12 lines
422 B
JavaScript
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);
|
|
}
|