UNPKG

@epicallan/money-ts

Version:

TypeScript library for type-safe and lossless encoding and manipulation of world currencies and precious metals

35 lines 1.6 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Ring = exports.show = exports.isPositive = exports.Ord = exports.sign = exports.isZero = exports.Eq = exports.div = exports.zero = exports.sub = exports.negate = exports.one = exports.mul = exports.add = exports.unwrap = exports.wrap = void 0; var ORD = require("fp-ts/Ord"); var bigInteger = require("./BigInteger"); var function_1 = require("fp-ts/function"); exports.wrap = function_1.unsafeCoerce; exports.unwrap = function_1.unsafeCoerce; exports.add = function_1.unsafeCoerce(bigInteger.add); exports.mul = function_1.unsafeCoerce(bigInteger.mul); exports.one = exports.wrap(bigInteger.one); exports.negate = function_1.unsafeCoerce(bigInteger.negate); exports.sub = function_1.unsafeCoerce(bigInteger.sub); exports.zero = exports.wrap(bigInteger.zero); function div(x, y) { return exports.wrap(exports.unwrap(x).divide(exports.unwrap(y))); } exports.div = div; exports.Eq = function_1.unsafeCoerce(bigInteger.Eq); var isZero = function (x) { return exports.Eq.equals(exports.zero, x); }; exports.isZero = isZero; function sign(x) { return function_1.unsafeCoerce(exports.unwrap(x).compare(bigInteger.zero)); } exports.sign = sign; exports.Ord = function_1.unsafeCoerce(bigInteger.Ord); var lessThanO = ORD.lt(exports.Ord); var isPositive = function (x) { return lessThanO(exports.zero, x); }; exports.isPositive = isPositive; function show(x) { return exports.unwrap(x).toString(); } exports.show = show; exports.Ring = function_1.unsafeCoerce(bigInteger.Ring); //# sourceMappingURL=Integer.js.map