UNPKG

@melonproject/token-math

Version:

A small helper library to do precision safe calculations

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