UNPKG

638 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.formatNumber = void 0;
4const toBn_js_1 = require("../bn/toBn.js");
5const formatDecimal_js_1 = require("./formatDecimal.js");
6const getSeparator_js_1 = require("./getSeparator.js");
7/**
8 * @name formatNumber
9 * @description Formats a number into string format with thousand separators
10 */
11function formatNumber(value, { locale = 'en' } = {}) {
12 const { thousand } = (0, getSeparator_js_1.getSeparator)(locale);
13 return (0, formatDecimal_js_1.formatDecimal)((0, toBn_js_1.bnToBn)(value).toString(), thousand);
14}
15exports.formatNumber = formatNumber;