-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathezmoney.api.ts
250 lines (178 loc) · 9.91 KB
/
ezmoney.api.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
// @public
declare function absolute<C extends string>(monetaryValue: MonetaryValue<C>): MonetaryValue<C>;
// @public
declare function add<C extends string>(monetaryValue1: MonetaryValue<C>, monetaryValue2: MonetaryValue<C>): MonetaryValue<C>;
// @public
declare function allocate<C extends string>(monetaryValue: MonetaryValue<C>, weights: number[]): MonetaryValue<C>[];
// @public
declare function compare<C extends string>(monetaryValue1: MonetaryValue<C>, monetaryValue2: MonetaryValue<C>): Comparison;
// @public
declare const enum Comparison {
EQ = 0,
GT = 1,
LT = -1
}
// @public
declare function create<C extends string>(amount: number, currency: C, precision?: number): MonetaryValue<C>;
// @public
declare const enum CurrencyDisplay {
Code = "code",
Name = "name",
Symbol = "symbol"
}
// @alpha
declare const enum CurrencySign {
Accounting = "accounting",
Standard = "standard"
}
// @public
declare function divide<C extends string>(monetaryValue: MonetaryValue<C>, divider: number, dividerPrecision: number, roundingFunction?: RoundingFunction): MonetaryValue<C>;
// @public
declare function equal<C extends string>(monetaryValue1: MonetaryValue<C>, monetaryValue2: MonetaryValue<C>): boolean;
// @public
declare function equivalent<C extends string>(monetaryValue1: MonetaryValue<C>, monetaryValue2: MonetaryValue<C>): boolean;
// @public
declare function format<C extends string>(monetaryValue: MonetaryValue<C>, locales?: string | string[], options?: MonetaryValueFormatOptions): string;
// @public
declare function fromNumber<C extends string>(number: number, currency: C, precision?: number, roundingFunction?: RoundingFunction): MonetaryValue<C>;
// @public
declare function fromString(str: string): MonetaryValue;
// @public
declare function greaterThan<C extends string>(monetaryValue1: MonetaryValue<C>, monetaryValue2: MonetaryValue<C>): boolean;
// @public
declare function greaterThanOrEqual<C extends string>(monetaryValue1: MonetaryValue<C>, monetaryValue2: MonetaryValue<C>): boolean;
// @public
declare function identical<C extends string>(monetaryValue1: MonetaryValue<C>, monetaryValue2: MonetaryValue<C>): boolean;
// @public
declare function integerDivide<C extends string>(monetaryValue: MonetaryValue<C>, divider: number, roundingFunction?: RoundingFunction): MonetaryValue<C>;
// @public
declare function isFormatSupported(): boolean;
// @public
declare function isMonetaryValue(arg: unknown): arg is MonetaryValue;
// @public
declare function lessThan<C extends string>(monetaryValue1: MonetaryValue<C>, monetaryValue2: MonetaryValue<C>): boolean;
// @public
declare function lessThanOrEqual<C extends string>(monetaryValue1: MonetaryValue<C>, monetaryValue2: MonetaryValue<C>): boolean;
// @public
declare const enum LocaleMatcher {
BestFit = "best fit",
Lookup = "lookup"
}
// @public
declare function matchPrecision<C extends string>(monetaryValue: MonetaryValue<C>, precision: number): MonetaryValue<C>;
// @public
declare function maximum<C extends string>(monetaryValue1: MonetaryValue<C>, monetaryValue2: MonetaryValue<C>): MonetaryValue<C>;
// @public
declare function minimum<C extends string>(monetaryValue1: MonetaryValue<C>, monetaryValue2: MonetaryValue<C>): MonetaryValue<C>;
// @public
interface MonetaryValue<C extends string = string> {
readonly amount: number;
readonly currency: C;
readonly precision: number;
}
// @public
interface MonetaryValueFormatOptions {
currencyDisplay?: CurrencyDisplay;
// @alpha
currencySign?: CurrencySign;
localeMatcher?: LocaleMatcher;
// @alpha
signDisplay?: SignDisplay;
useGrouping?: boolean;
}
// @public
declare function multiply<C extends string>(monetaryValue: MonetaryValue<C>, factor: number, factorPrecision: number, roundingFunction?: RoundingFunction): MonetaryValue<C>;
// @public
declare function negate<C extends string>(monetaryValue: MonetaryValue<C>): MonetaryValue<C>;
// @public
declare function roundAwayFromZero(wholePart: number, numeratorFractionalPart: number, denominatorFractionalPart?: number): number;
// @public
declare function roundDown(wholePart: number, numeratorFractionalPart: number, denominatorFractionalPart?: number): number;
// @public
declare function roundHalfAwayFromZero(wholePart: number, numeratorFractionalPart: number, denominatorFractionalPart: number): number;
// @public
declare function roundHalfDown(wholePart: number, numeratorFractionalPart: number, denominatorFractionalPart: number): number;
// @public
declare function roundHalfToEven(wholePart: number, numeratorFractionalPart: number, denominatorFractionalPart: number): number;
// @public
declare function roundHalfToOdd(wholePart: number, numeratorFractionalPart: number, denominatorFractionalPart: number): number;
// @public
declare function roundHalfTowardsZero(wholePart: number, numeratorFractionalPart: number, denominatorFractionalPart: number): number;
// @public
declare function roundHalfUp(wholePart: number, numeratorFractionalPart: number, denominatorFractionalPart: number): number;
// @public
declare type RoundingFunction = (
wholePart: number,
numeratorFractionalPart: number,
denominatorFractionalPart: number) => number;
// @public
declare function roundTowardsZero(wholePart: number, numeratorFractionalPart?: number, denominatorFractionalPart?: number): number;
// @public
declare function roundUp(wholePart: number, numeratorFractionalPart: number, denominatorFractionalPart?: number): number;
// @public
declare function setPrecision<C extends string>(monetaryValue: MonetaryValue<C>, precision: number, roundingFunction?: RoundingFunction): MonetaryValue<C>;
// @alpha
declare const enum SignDisplay {
Always = "always",
Auto = "auto",
ExceptZero = "exceptZero",
Never = "never"
}
// @public
declare function subtract<C extends string>(monetaryValue1: MonetaryValue<C>, monetaryValue2: MonetaryValue<C>): MonetaryValue<C>;
// @public
declare function toNumber<C extends string>(monetaryValue: MonetaryValue<C>): number;
// @public
declare function toString(monetaryValue: MonetaryValue): string;
// @public
declare function unsafeAbsolute<C extends string>(monetaryValue: MonetaryValue<C>): MonetaryValue<C>;
// @public
declare function unsafeAdd<C extends string>(monetaryValue1: MonetaryValue<C>, monetaryValue2: MonetaryValue<C>): MonetaryValue<C>;
// @public
declare function unsafeAllocate<C extends string>(monetaryValue: MonetaryValue<C>, weights: number[]): MonetaryValue<C>[];
// @public
declare function unsafeCompare<C extends string>(monetaryValue1: MonetaryValue<C>, monetaryValue2: MonetaryValue<C>): Comparison;
// @public
declare function unsafeCreate<C extends string>(amount: number, currency: C, precision?: number): MonetaryValue<C>;
// @public
declare function unsafeDivide<C extends string>(monetaryValue: MonetaryValue<C>, divider: number, dividerPrecision: number, roundingFunction?: RoundingFunction): MonetaryValue<C>;
// @public
declare function unsafeEqual<C extends string>(monetaryValue1: MonetaryValue<C>, monetaryValue2: MonetaryValue<C>): boolean;
// @public
declare function unsafeEquivalent<C extends string>(monetaryValue1: MonetaryValue<C>, monetaryValue2: MonetaryValue<C>): boolean;
// @public
declare function unsafeFormat<C extends string>(monetaryValue: MonetaryValue<C>, locales?: string | string[], formatOptions?: MonetaryValueFormatOptions): string;
// @public
declare function unsafeFromNumber<C extends string>(number: number, currency: C, precision?: number, roundingFunction?: RoundingFunction): MonetaryValue<C>;
// @public
declare function unsafeFromString(str: string): MonetaryValue;
// @public
declare function unsafeGreaterThan<C extends string>(monetaryValue1: MonetaryValue<C>, monetaryValue2: MonetaryValue<C>): boolean;
// @public
declare function unsafeGreaterThanOrEqual<C extends string>(monetaryValue1: MonetaryValue<C>, monetaryValue2: MonetaryValue<C>): boolean;
// @public
declare function unsafeIdentical<C extends string>(monetaryValue1: MonetaryValue<C>, monetaryValue2: MonetaryValue<C>): boolean;
// @public
declare function unsafeIntegerDivide<C extends string>(monetaryValue: MonetaryValue<C>, divider: number, roundingFunction?: RoundingFunction): MonetaryValue<C>;
// @public
declare function unsafeLessThan<C extends string>(monetaryValue1: MonetaryValue<C>, monetaryValue2: MonetaryValue<C>): boolean;
// @public
declare function unsafeLessThanOrEqual<C extends string>(monetaryValue1: MonetaryValue<C>, monetaryValue2: MonetaryValue<C>): boolean;
// @public
declare function unsafeMatchPrecision<C extends string>(monetaryValue: MonetaryValue<C>, precision: number): MonetaryValue<C>;
// @public
declare function unsafeMaximum<C extends string>(monetaryValue1: MonetaryValue<C>, monetaryValue2: MonetaryValue<C>): MonetaryValue<C>;
// @public
declare function unsafeMinimum<C extends string>(monetaryValue1: MonetaryValue<C>, monetaryValue2: MonetaryValue<C>): MonetaryValue<C>;
// @public
declare function unsafeMultiply<C extends string>(monetaryValue: MonetaryValue<C>, factor: number, factorPrecision: number, roundingFunction?: RoundingFunction): MonetaryValue<C>;
// @public
declare function unsafeNegate<C extends string>(monetaryValue: MonetaryValue<C>): MonetaryValue<C>;
// @public
declare function unsafeSetPrecision<C extends string>(monetaryValue: MonetaryValue<C>, precision: number, roundingFunction?: RoundingFunction): MonetaryValue<C>;
// @public
declare function unsafeSubtract<C extends string>(monetaryValue1: MonetaryValue<C>, monetaryValue2: MonetaryValue<C>): MonetaryValue<C>;
// @public (undocumented)
declare function unsafeToNumber<C extends string>(monetaryValue: MonetaryValue<C>): number;
// @public
declare function unsafeToString<C extends string>(monetaryValue: MonetaryValue<C>): string;