choerodon-ui
Version:
An enterprise-class UI design language and React-based implementation
19 lines (15 loc) • 713 B
JavaScript
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
import { getNumberFormatOptions, toLocaleStringPolyfill, toLocaleStringSupportsLocales } from './utils';
import normalizeLanguage from '../_util/normalizeLanguage';
import { FieldType } from '../data-set/enum';
export default function formatCurrency(value, lang, options) {
var v = parseFloat(value);
if (!isNaN(v)) {
if (toLocaleStringSupportsLocales()) {
return v.toLocaleString(normalizeLanguage(lang), _objectSpread({}, getNumberFormatOptions(FieldType.currency, options), {}, options));
}
return toLocaleStringPolyfill(v, FieldType.currency, options);
}
return value;
}
//# sourceMappingURL=formatCurrency.js.map