UNPKG

money-ts

Version:

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

8 lines 565 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var t = require("io-ts"); var BI = require("big-integer"); var bigInteger = require("../BigInteger"); var StringOrNumber = t.union([t.string, t.number]); exports.BigInteger = new t.Type('BigInteger', function (m) { return m instanceof BI; }, function (m, c) { return StringOrNumber.validate(m, c).chain(function (s) { return bigInteger.wrap(s).foldL(function () { return t.failure(s, c); }, t.success); }); }, function (a) { return a.toString(); }); //# sourceMappingURL=BigInteger.js.map