UNPKG

devextreme

Version:

JavaScript/TypeScript Component Suite for Responsive Web Development

27 lines (26 loc) 1.01 kB
/** * DevExtreme (esm/__internal/core/localization/currency.js) * Version: 25.2.7 * Build date: Tue May 05 2026 * * Copyright (c) 2012 - 2026 Developer Express Inc. ALL RIGHTS RESERVED * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/ */ export default { _formatNumberCore(value, format, formatConfig) { if ("currency" === format) { formatConfig.precision = formatConfig.precision ?? 0; let result = this.format(value, Object.assign({}, formatConfig, { type: "fixedpoint" })); const currencyPart = this.getCurrencySymbol().symbol.replace(/\$/g, "$$$$"); result = result.replace(/^(\D*)(\d.*)/, `$1${currencyPart}$2`); return result } return this.callBase.apply(this, [value, format, formatConfig]) }, getCurrencySymbol: () => ({ symbol: "$" }), getOpenXmlCurrencyFormat: () => "$#,##0{0}_);\\($#,##0{0}\\)" };