UNPKG

@melonproject/token-math

Version:

A small helper library to do precision safe calculations

16 lines (15 loc) 636 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const add_1 = __importDefault(require("../bigInteger/add")); const isQuantity_1 = __importDefault(require("../quantity/isQuantity")); const add_2 = __importDefault(require("../quantity/add")); const add = (...summands) => { if (isQuantity_1.default(summands[0]) && isQuantity_1.default(summands[1])) { return add_2.default(...summands); } return add_1.default(...summands); }; exports.default = add;