@aplus-frontend/ui
Version:
46 lines (45 loc) • 831 B
JavaScript
import { Decimal as u } from "decimal.js";
function l(...e) {
if (!e || !e.length)
return;
let t = new u(0);
return e.forEach((n) => {
t = t.plus(new u(n));
}), t.toNumber();
}
const f = l;
function r(...e) {
if (!e || !e.length)
return;
let t = new u(e[0]);
for (let n = 1; n <= e.length - 1; n += 1)
t = t.sub(new u(e[n]));
return t.toNumber();
}
const c = r;
function o(...e) {
if (!e || !e.length)
return;
let t = new u(1);
return e.forEach((n) => {
t = t.mul(new u(n));
}), t.toNumber();
}
const h = o;
function w(...e) {
if (!e || !e.length)
return;
let t = new u(e[0]);
for (let n = 1; n <= e.length - 1; n += 1)
t = t.div(new u(e[n]));
return t.toNumber();
}
export {
f as add,
w as div,
c as minus,
o as mul,
l as plus,
r as sub,
h as times
};