@epicallan/money-ts
Version:
TypeScript library for type-safe and lossless encoding and manipulation of world currencies and precious metals
27 lines (26 loc) • 1.15 kB
TypeScript
import { Newtype } from 'newtype-ts';
import * as EQ from 'fp-ts/Eq';
import * as ORD from 'fp-ts/Ord';
import { BigInteger } from 'big-integer';
import { NonZeroInteger } from './NonZeroInteger';
import * as R from 'fp-ts/Ring';
export interface Integer extends Newtype<{
Integer: true;
}, BigInteger> {
}
export declare const wrap: (x: BigInteger) => Integer;
export declare const unwrap: (x: Integer) => BigInteger;
export declare const add: (x: Integer, y: Integer) => Integer;
export declare const mul: (x: Integer, y: Integer) => Integer;
export declare const one: Integer;
export declare const negate: (x: Integer) => Integer;
export declare const sub: (x: Integer, y: Integer) => Integer;
export declare const zero: Integer;
export declare function div(x: Integer, y: NonZeroInteger): Integer;
export declare const Eq: EQ.Eq<Integer>;
export declare const isZero: (x: Integer) => boolean;
export declare function sign(x: Integer): -1 | 0 | 1;
export declare const Ord: ORD.Ord<Integer>;
export declare const isPositive: (x: Integer) => boolean;
export declare function show(x: Integer): string;
export declare const Ring: R.Ring<Integer>;