money-ts
Version:
TypeScript library for type-safe and lossless encoding and manipulation of world currencies and precious metals
18 lines • 747 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var positiveRational = require("../PositiveRational");
var bigInteger = require("../BigInteger");
var natural = require("../Natural");
var fromSome = function (fa) {
return fa.getOrElseL(function () {
throw new Error('fromSome called with None');
});
};
function unsafePositiveRational(_a) {
var x = _a[0], y = _a[1];
var on = bigInteger.wrap(x).chain(natural.wrap);
var od = bigInteger.wrap(y).chain(natural.wrap);
return fromSome(od.ap(on.map(function (n) { return function (d) { return positiveRational.reduce(n, d); }; })));
}
exports.unsafePositiveRational = unsafePositiveRational;
//# sourceMappingURL=unsafePositiveRational.js.map