money-ts
Version:
TypeScript library for type-safe and lossless encoding and manipulation of world currencies and precious metals
32 lines • 1.34 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var newtype_ts_1 = require("newtype-ts");
var Ord_1 = require("fp-ts/lib/Ord");
var bigInteger = require("./BigInteger");
exports.wrap = newtype_ts_1.unsafeCoerce;
exports.unwrap = newtype_ts_1.unsafeCoerce;
exports.add = newtype_ts_1.unsafeCoerce(bigInteger.add);
exports.mul = newtype_ts_1.unsafeCoerce(bigInteger.mul);
exports.one = exports.wrap(bigInteger.one);
exports.negate = newtype_ts_1.unsafeCoerce(bigInteger.negate);
exports.sub = newtype_ts_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.setoid = newtype_ts_1.unsafeCoerce(bigInteger.setoid);
exports.isZero = function (x) { return exports.setoid.equals(exports.zero, x); };
function sign(x) {
return newtype_ts_1.unsafeCoerce(exports.unwrap(x).compare(bigInteger.zero));
}
exports.sign = sign;
exports.ord = newtype_ts_1.unsafeCoerce(bigInteger.ord);
var lessThanO = Ord_1.lessThan(exports.ord);
exports.isPositive = function (x) { return lessThanO(exports.zero, x); };
function show(x) {
return exports.unwrap(x).toString();
}
exports.show = show;
exports.ring = newtype_ts_1.unsafeCoerce(bigInteger.ring);
//# sourceMappingURL=Integer.js.map