UNPKG

@aplus-frontend/ui

Version:

33 lines (32 loc) 778 B
import { div as p, mul as a } from "./decimal.mjs"; import "./index.mjs"; import { isDef as e } from "./is.mjs"; function m(r, o = 0) { if (!e(r)) return; const t = Math.pow(10, o); return p(Math.round(a(r, t)), t); } function g(r, o = 0) { if (!e(r)) return; const t = Math.pow(10, o); return p(Math.floor(a(r, t)), t); } function w(r, o) { if (!e(r)) return; let t = typeof o < "u" ? m(r, o) : r; const i = t < 0; i && (t = Math.abs(t)); const f = String(t).split("."), h = f[0].split(""), c = f[1] || ""; let n = ""; return h.reverse().forEach(function(s, u) { u !== 0 && u % 3 === 0 ? n = s + "," + n : n = s + n; }), (i ? "-" : "") + n + (c ? "." + c : ""); } export { g as floorWith, m as roundWith, w as toDecimalMark };