-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmbn.d.ts
102 lines (58 loc) · 2.07 KB
/
mbn.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
type MbnArg = number | boolean | null | undefined | string | Mbn;
type MbnOneArgFn = "set" | "abs" | "inva" | "invm" | "ceil" | "floor" | "sqrt" | "round" | "sgn" | "intp";
type MbnTwoArgFn = "min" | "max" | "add" | "sub" | "mul" | "div" | "mod" | "pow";
interface MbnDispOpt {
MbnP?: number,
MbnS?: "." | ",",
MbnT?: boolean,
MbnF?: boolean,
}
interface MbnOpt extends MbnDispOpt {
MbnE?: boolean | null
}
interface Mbn {
set(b: MbnArg): Mbn;
toString(): string;
format(f?: boolean | MbnDispOpt): string;
toNumber(): number;
cmp(b: MbnArg, d?: MbnArg): -1 | 0 | 1;
add(b: MbnArg, m?: boolean): Mbn;
sub(b: MbnArg, m?: boolean): Mbn;
mul(b: MbnArg, m?: boolean): Mbn;
div(b: MbnArg, m?: boolean): Mbn;
mod(b: MbnArg, m?: boolean): Mbn;
split(ar?: MbnArg[] | MbnArg): Mbn[];
isInt(): boolean;
floor(m?: boolean): Mbn;
round(m?: boolean): Mbn;
abs(m?: boolean): Mbn;
inva(m?: boolean): Mbn;
invm(m?: boolean): Mbn;
ceil(m?: boolean): Mbn;
intp(m?: boolean): Mbn;
eq(b: MbnArg, d?: MbnArg): boolean;
min(b: MbnArg, m?: boolean): Mbn;
max(b: MbnArg, m?: boolean): Mbn;
sqrt(m?: boolean): Mbn;
sgn(m?: boolean): Mbn;
pow(b: MbnArg, m?: boolean): Mbn;
fact(m?: boolean): Mbn;
}
interface MbnConstructor {
(n?: MbnArg, v?: boolean | Partial<Record<string, MbnArg>>): Mbn;
new(n?: MbnArg, v?: boolean | Partial<Record<string, MbnArg>>): Mbn;
reduce(fn: MbnOneArgFn, arr: MbnArg[]): Mbn[];
reduce(fn: MbnTwoArgFn, arr: MbnArg[]): Mbn;
reduce(fn: MbnTwoArgFn, arr: MbnArg[], b: MbnArg | MbnArg[]): Mbn[];
reduce(fn: MbnTwoArgFn, arr: MbnArg, b: MbnArg[]): Mbn[];
def(n: string, v?: MbnArg): Mbn;
def(n: null, v?: string): boolean;
calc(exp: string, vars?: Partial<Record<string, MbnArg>>): Mbn;
check(exp: string): string[] | false;
prototype: Mbn;
}
interface MbnConstructorParent extends MbnConstructor {
extend(opt?: number | MbnOpt): MbnConstructor;
}
declare const Mbn: MbnConstructorParent;
export = Mbn;