UNPKG

@panyam/tsutils

Version:

Some basic TS utils for personal use

48 lines (47 loc) 2.07 kB
import { Nullable } from "./types"; export declare function range(start: number, end?: Nullable<number>, incr?: Nullable<number>): number[]; export declare function gcdof(x: number, y: number): number; export declare class Fraction { readonly num: number; readonly den: number; static readonly ZERO: Fraction; static readonly ONE: Fraction; static readonly INFINITY: Fraction; constructor(num?: number, den?: number, factorized?: boolean); static parse(val: string, factorized?: boolean): Fraction; get isWhole(): boolean; get isZero(): boolean; get isInfinity(): boolean; get isOne(): boolean; get ceil(): number; get floor(): number; plus(another: Fraction, factorized?: boolean): Fraction; plusNum(another: number, factorized?: boolean): Fraction; minus(another: Fraction, factorized?: boolean): Fraction; minusNum(another: number, factorized?: boolean): Fraction; times(another: Fraction, factorized?: boolean): Fraction; timesNum(another: number, factorized?: boolean): Fraction; divby(another: Fraction, factorized?: boolean): Fraction; divbyNum(another: number, factorized?: boolean): Fraction; numDivby(another: number, factorized?: boolean): Fraction; mod(another: Fraction): Fraction; modNum(another: number): Fraction; get inverse(): Fraction; get factorized(): Fraction; equals(another: Fraction): boolean; equalsNum(another: number): boolean; cmp(another: Fraction): number; cmpNum(another: number): number; isLT(another: Fraction): boolean; isLTE(another: Fraction): boolean; isLTNum(another: number): boolean; isLTENum(another: number): boolean; isGT(another: Fraction): boolean; isGTE(another: Fraction): boolean; isGTNum(another: number): boolean; isGTENum(another: number): boolean; toString(): string; static max(f1: Fraction, f2: Fraction): Fraction; static min(f1: Fraction, f2: Fraction): Fraction; } export declare const Frac: (a?: number, b?: number, factorized?: boolean) => Fraction;