UNPKG

@aplus-frontend/ui

Version:

24 lines (23 loc) 564 B
import { isNil as a } from "lodash-unified"; import { toDecimalMark as f } from "../../utils/format.mjs"; function n(t, e) { if (a(e)) return t; let [i, r = ""] = t.split("."); if (r.length >= e) return t; for (let l = r.length; l < e; l++) r += "0"; return i + "." + r; } function u(t, e) { const i = t; if (a(i)) return e?.emptyText; let r = e?.thousands ? f(i, e.precision) : String(i); return e?.precision && e.limitDecimalsRetain && (r = n(r, e.precision)), r; } export { n as addZeroToDecimalPlaces, u as getValueStr };