import isNil from 'lodash/isNil';
import { numberFormat } from '@cainiaofe/cn-ui-common';
import { isNumberStr } from '../../utils';
export function getNumFromStr(val, adapterLocale) {
    return isNumberStr(`${val}`) ? formatCurrency(`${val}`, adapterLocale) : val;
}
export function formatCurrency(val, adapterLocale) {
    if (adapterLocale) {
        return numberFormat(val, adapterLocale);
    }
    const [pre, suff] = val === null || val === void 0 ? void 0 : val.split('.');
    return `${Number(pre).toLocaleString('zh-CN')}${isNil(suff) ? '' : `.${suff}`}`;
}
