@agrozyme/numeric 1.0.12 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/root/index.ts CHANGED
@@ -1,3 +1,5 @@
1
+ // noinspection JSUnusedGlobalSymbols
2
+
1
3
  import { BigNumber, BigNumberish } from '@ethersproject/bignumber';
2
4
  import { hexlify, isBytesLike } from '@ethersproject/bytes';
3
5
  import * as constants from '@ethersproject/constants';
@@ -6,7 +8,7 @@ import BN from 'bn.js';
6
8
  import { isNode } from 'browser-or-node';
7
9
  import { Decimal } from 'decimal.js';
8
10
  import formatter from 'format-number';
9
- import { InspectOptionsStylized } from 'util';
11
+ import { InspectOptionsStylized } from 'node:util';
10
12
 
11
13
  // const inspect = Symbol.for('nodejs.util.inspect.custom');
12
14
 
@@ -29,7 +31,7 @@ export interface IFormatNumberOptions {
29
31
  truncate?: number;
30
32
  }
31
33
 
32
- //noinspection FunctionNamingConventionJS
34
+ // noinspection LocalVariableNamingConventionJS
33
35
  export class Numeric extends Decimal {
34
36
  // private readonly toStringTag: string = 'Decimal';
35
37
 
@@ -62,510 +64,277 @@ export class Numeric extends Decimal {
62
64
  return 'Numeric';
63
65
  }
64
66
 
65
- static abs(value: NumericValue) {
66
- return new Numeric(value).abs();
67
- }
67
+ static abs = (value: NumericValue) => new Numeric(value).abs();
68
68
 
69
- static acos(value: NumericValue) {
70
- return new Numeric(value).acos();
71
- }
69
+ static acos = (value: NumericValue) => new Numeric(value).acos();
72
70
 
73
- static acosh(value: NumericValue) {
74
- return new Numeric(value).acosh();
75
- }
71
+ static acosh = (value: NumericValue) => new Numeric(value).acosh();
76
72
 
77
- static add(x: NumericValue, y: NumericValue) {
78
- return new Numeric(x).add(y);
79
- }
73
+ static add = (x: NumericValue, y: NumericValue) => new Numeric(x).add(y);
80
74
 
81
- static asin(value: NumericValue) {
82
- return new Numeric(value).asin();
83
- }
75
+ static asin = (value: NumericValue) => new Numeric(value).asin();
84
76
 
85
- static asinh(value: NumericValue) {
86
- return new Numeric(value).asinh();
87
- }
77
+ static asinh = (value: NumericValue) => new Numeric(value).asinh();
88
78
 
89
- static atan(value: NumericValue) {
90
- return new Numeric(value).atan();
91
- }
79
+ static atan = (value: NumericValue) => new Numeric(value).atan();
92
80
 
93
- static atan2(x: NumericValue, y: NumericValue) {
94
- return new Numeric(Decimal.atan2(new Numeric(x), new Numeric(y)));
95
- }
81
+ static atan2 = (x: NumericValue, y: NumericValue) => new Numeric(Decimal.atan2(new Numeric(x), new Numeric(y)));
96
82
 
97
- static atanh(value: NumericValue) {
98
- return new Numeric(value).atanh();
99
- }
83
+ static atanh = (value: NumericValue) => new Numeric(value).atanh();
100
84
 
101
- static cbrt(value: NumericValue) {
102
- return new Numeric(value).cbrt();
103
- }
85
+ static cbrt = (value: NumericValue) => new Numeric(value).cbrt();
104
86
 
105
- static ceil(value: NumericValue) {
106
- return new Numeric(value).ceil();
107
- }
87
+ static ceil = (value: NumericValue) => new Numeric(value).ceil();
108
88
 
109
- static cos(value: NumericValue) {
110
- return new Numeric(value).cos();
111
- }
89
+ static cos = (value: NumericValue) => new Numeric(value).cos();
112
90
 
113
- static cosh(value: NumericValue) {
114
- return new Numeric(value).cosh();
115
- }
91
+ static cosh = (value: NumericValue) => new Numeric(value).cosh();
116
92
 
117
- static div(x: NumericValue, y: NumericValue) {
118
- return new Numeric(x).div(y);
119
- }
93
+ static div = (x: NumericValue, y: NumericValue) => new Numeric(x).div(y);
120
94
 
121
- static exp(value: NumericValue) {
122
- return new Numeric(value).exp();
123
- }
95
+ static exp = (value: NumericValue) => new Numeric(value).exp();
124
96
 
125
- static floor(value: NumericValue) {
126
- return new Numeric(value).floor();
127
- }
97
+ static floor = (value: NumericValue) => new Numeric(value).floor();
128
98
 
129
- static hypot(...values: NumericValue[]) {
130
- return new Numeric(Decimal.hypot(...toNumerics(values)));
131
- }
99
+ static hypot = (...values: NumericValue[]) => new Numeric(Decimal.hypot(...toNumerics(values)));
132
100
 
133
- static ln(value: NumericValue) {
134
- return new Numeric(value).ln();
135
- }
101
+ static ln = (value: NumericValue) => new Numeric(value).ln();
136
102
 
137
- static log(value: NumericValue, base?: NumericValue) {
138
- return new Numeric(value).log(base);
139
- }
103
+ static log = (value: NumericValue, base?: NumericValue) => new Numeric(value).log(base);
140
104
 
141
- static log10(value: NumericValue) {
142
- return new Numeric(value).log(10);
143
- }
105
+ static log10 = (value: NumericValue) => new Numeric(value).log(10);
144
106
 
145
- static log2(value: NumericValue) {
146
- return new Numeric(value).log(2);
147
- }
107
+ static log2 = (value: NumericValue) => new Numeric(value).log(2);
148
108
 
149
- static max(...values: NumericValue[]) {
150
- return new Numeric(Decimal.max(...toNumerics(values)));
151
- }
109
+ static max = (...values: NumericValue[]) => new Numeric(Decimal.max(...toNumerics(values)));
152
110
 
153
- static min(...values: NumericValue[]) {
154
- return new Numeric(Decimal.min(...toNumerics(values)));
155
- }
111
+ static min = (...values: NumericValue[]) => new Numeric(Decimal.min(...toNumerics(values)));
156
112
 
157
- static mod(x: NumericValue, y: NumericValue) {
158
- return new Numeric(x).mod(y);
159
- }
113
+ static mod = (x: NumericValue, y: NumericValue) => new Numeric(x).mod(y);
160
114
 
161
- static mul(x: NumericValue, y: NumericValue) {
162
- return new Numeric(x).mul(y);
163
- }
115
+ static mul = (x: NumericValue, y: NumericValue) => new Numeric(x).mul(y);
164
116
 
165
- static pow(base: NumericValue, exponent: NumericValue) {
166
- return new Numeric(base).pow(exponent);
167
- }
117
+ static pow = (base: NumericValue, exponent: NumericValue) => new Numeric(base).pow(exponent);
168
118
 
169
- static random(significantDigits?: number) {
170
- return new Numeric(Decimal.random(significantDigits));
171
- }
119
+ static random = (significantDigits?: number) => new Numeric(Decimal.random(significantDigits));
172
120
 
173
- static round(value: NumericValue) {
174
- return new Numeric(value).round();
175
- }
121
+ static round = (value: NumericValue) => new Numeric(value).round();
176
122
 
177
- static set(object: Decimal.Config) {
178
- return Decimal.set(object);
179
- }
123
+ static set = (object: Decimal.Config) => Decimal.set(object);
180
124
 
181
- static sign(value: NumericValue) {
182
- return new Numeric(Decimal.sign(new Numeric(value)));
183
- }
125
+ static sign = (value: NumericValue) => Decimal.sign(new Numeric(value));
184
126
 
185
- static sin(value: NumericValue) {
186
- return new Numeric(value).sin();
187
- }
127
+ static sin = (value: NumericValue) => new Numeric(value).sin();
188
128
 
189
- static sinh(value: NumericValue) {
190
- return new Numeric(value).sinh();
191
- }
129
+ static sinh = (value: NumericValue) => new Numeric(value).sinh();
192
130
 
193
- static sqrt(value: NumericValue) {
194
- return new Numeric(value).sqrt();
195
- }
131
+ static sqrt = (value: NumericValue) => new Numeric(value).sqrt();
196
132
 
197
- static sub(x: NumericValue, y: NumericValue) {
198
- return new Numeric(x).sub(y);
199
- }
133
+ static sub = (x: NumericValue, y: NumericValue) => new Numeric(x).sub(y);
200
134
 
201
- static tan(value: NumericValue) {
202
- return new Numeric(value).tan();
203
- }
135
+ static tan = (value: NumericValue) => new Numeric(value).tan();
204
136
 
205
- static tanh(value: NumericValue) {
206
- return new Numeric(value).tanh();
207
- }
137
+ static tanh = (value: NumericValue) => new Numeric(value).tanh();
208
138
 
209
- static trunc(value: NumericValue) {
210
- return new Numeric(value).trunc();
211
- }
139
+ static trunc = (value: NumericValue) => new Numeric(value).trunc();
212
140
 
213
- abs() {
214
- return new Numeric(super.abs());
215
- }
141
+ abs = () => new Numeric(super.abs());
216
142
 
217
- absoluteValue() {
218
- return new Numeric(super.absoluteValue());
219
- }
143
+ absoluteValue = () => new Numeric(super.absoluteValue());
220
144
 
221
- acos() {
222
- return new Numeric(super.acos());
223
- }
145
+ acos = () => new Numeric(super.acos());
224
146
 
225
- acosh() {
226
- return new Numeric(super.acosh());
227
- }
147
+ acosh = () => new Numeric(super.acosh());
228
148
 
229
- add(value: NumericValue) {
230
- return new Numeric(super.add(new Numeric(value)));
231
- }
149
+ add = (value: NumericValue) => new Numeric(super.add(new Numeric(value)));
232
150
 
233
- asin() {
234
- return new Numeric(super.asin());
235
- }
151
+ asin = () => new Numeric(super.asin());
236
152
 
237
- asinh() {
238
- return new Numeric(super.asinh());
239
- }
153
+ asinh = () => new Numeric(super.asinh());
240
154
 
241
- atan() {
242
- return new Numeric(super.atan());
243
- }
155
+ atan = () => new Numeric(super.atan());
244
156
 
245
- atanh() {
246
- return new Numeric(super.atanh());
247
- }
157
+ atanh = () => new Numeric(super.atanh());
248
158
 
249
- cbrt() {
250
- return new Numeric(super.cbrt());
251
- }
159
+ cbrt = () => new Numeric(super.cbrt());
252
160
 
253
- ceil() {
254
- return new Numeric(super.ceil());
255
- }
161
+ ceil = () => new Numeric(super.ceil());
256
162
 
257
- cmp(value: NumericValue) {
258
- return super.cmp(new Numeric(value));
259
- }
163
+ cmp = (value: NumericValue) => super.cmp(new Numeric(value));
260
164
 
261
- comparedTo(value: NumericValue) {
262
- return super.comparedTo(new Numeric(value));
263
- }
165
+ comparedTo = (value: NumericValue) => super.comparedTo(new Numeric(value));
264
166
 
265
- cos() {
266
- return new Numeric(super.cos());
267
- }
167
+ cos = () => new Numeric(super.cos());
268
168
 
269
- cosh() {
270
- return new Numeric(super.cosh());
271
- }
169
+ cosh = () => new Numeric(super.cosh());
272
170
 
273
- cosine() {
274
- return new Numeric(super.cosine());
275
- }
171
+ cosine = () => new Numeric(super.cosine());
276
172
 
277
- cubeRoot() {
278
- return new Numeric(super.cubeRoot());
279
- }
173
+ cubeRoot = () => new Numeric(super.cubeRoot());
280
174
 
281
- div(value: NumericValue) {
282
- return new Numeric(super.div(new Numeric(value)));
283
- }
175
+ div = (value: NumericValue) => new Numeric(super.div(new Numeric(value)));
284
176
 
285
- divToInt(value: NumericValue) {
286
- return new Numeric(super.divToInt(new Numeric(value)));
287
- }
177
+ divToInt = (value: NumericValue) => new Numeric(super.divToInt(new Numeric(value)));
288
178
 
289
- dividedBy(value: NumericValue) {
290
- return new Numeric(super.dividedBy(new Numeric(value)));
291
- }
179
+ dividedBy = (value: NumericValue) => new Numeric(super.dividedBy(new Numeric(value)));
292
180
 
293
- dividedToIntegerBy(value: NumericValue) {
294
- return new Numeric(super.dividedToIntegerBy(new Numeric(value)));
295
- }
181
+ dividedToIntegerBy = (value: NumericValue) => new Numeric(super.dividedToIntegerBy(new Numeric(value)));
296
182
 
297
- eq(value: NumericValue) {
298
- return super.eq(new Numeric(value));
299
- }
183
+ eq = (value: NumericValue) => super.eq(new Numeric(value));
300
184
 
301
- equals(value: NumericValue) {
302
- return super.equals(new Numeric(value));
303
- }
185
+ equals = (value: NumericValue) => super.equals(new Numeric(value));
304
186
 
305
- exp() {
306
- return new Numeric(super.exp());
307
- }
187
+ exp = () => new Numeric(super.exp());
308
188
 
309
- floor() {
310
- return new Numeric(super.floor());
311
- }
189
+ floor = () => new Numeric(super.floor());
312
190
 
313
- greaterThan(value: NumericValue) {
314
- return super.greaterThan(new Numeric(value));
315
- }
191
+ greaterThan = (value: NumericValue) => super.greaterThan(new Numeric(value));
316
192
 
317
- greaterThanOrEqualTo(value: NumericValue) {
318
- return super.greaterThanOrEqualTo(new Numeric(value));
319
- }
193
+ greaterThanOrEqualTo = (value: NumericValue) => super.greaterThanOrEqualTo(new Numeric(value));
320
194
 
321
- gt(value: NumericValue) {
322
- return super.gt(new Numeric(value));
323
- }
195
+ gt = (value: NumericValue) => super.gt(new Numeric(value));
324
196
 
325
- gte(value: NumericValue) {
326
- return super.gte(new Numeric(value));
327
- }
197
+ gte = (value: NumericValue) => super.gte(new Numeric(value));
328
198
 
329
- hyperbolicCosine() {
330
- return new Numeric(super.hyperbolicCosine());
331
- }
199
+ hyperbolicCosine = () => new Numeric(super.hyperbolicCosine());
332
200
 
333
- hyperbolicSine() {
334
- return new Numeric(super.hyperbolicSine());
335
- }
201
+ hyperbolicSine = () => new Numeric(super.hyperbolicSine());
336
202
 
337
- hyperbolicTangent() {
338
- return new Numeric(super.hyperbolicTangent());
339
- }
203
+ hyperbolicTangent = () => new Numeric(super.hyperbolicTangent());
340
204
 
341
- inverseCosine() {
342
- return new Numeric(super.inverseCosine());
343
- }
205
+ inverseCosine = () => new Numeric(super.inverseCosine());
344
206
 
345
- inverseHyperbolicCosine() {
346
- return new Numeric(super.inverseHyperbolicCosine());
347
- }
207
+ inverseHyperbolicCosine = () => new Numeric(super.inverseHyperbolicCosine());
348
208
 
349
- inverseHyperbolicSine() {
350
- return new Numeric(super.inverseHyperbolicSine());
351
- }
209
+ inverseHyperbolicSine = () => new Numeric(super.inverseHyperbolicSine());
352
210
 
353
- inverseHyperbolicTangent() {
354
- return new Numeric(super.inverseHyperbolicTangent());
355
- }
211
+ inverseHyperbolicTangent = () => new Numeric(super.inverseHyperbolicTangent());
356
212
 
357
- inverseSine() {
358
- return new Numeric(super.inverseSine());
359
- }
213
+ inverseSine = () => new Numeric(super.inverseSine());
360
214
 
361
- inverseTangent() {
362
- return new Numeric(super.inverseTangent());
363
- }
215
+ inverseTangent = () => new Numeric(super.inverseTangent());
364
216
 
365
- lessThan(value: NumericValue) {
366
- return super.lessThan(new Numeric(value));
367
- }
217
+ lessThan = (value: NumericValue) => super.lessThan(new Numeric(value));
368
218
 
369
- lessThanOrEqualTo(value: NumericValue) {
370
- return super.lessThanOrEqualTo(new Numeric(value));
371
- }
219
+ lessThanOrEqualTo = (value: NumericValue) => super.lessThanOrEqualTo(new Numeric(value));
372
220
 
373
- ln() {
374
- return new Numeric(super.ln());
375
- }
221
+ ln = () => new Numeric(super.ln());
376
222
 
377
- log(value?: NumericValue) {
378
- return new Numeric(super.log(undefined === value ? undefined : new Numeric(value)));
379
- }
223
+ log = (value?: NumericValue) => new Numeric(super.log(undefined === value ? undefined : new Numeric(value)));
380
224
 
381
- logarithm(value?: NumericValue) {
382
- return new Numeric(super.logarithm(undefined === value ? undefined : new Numeric(value)));
383
- }
225
+ logarithm = (value?: NumericValue) =>
226
+ new Numeric(super.logarithm(undefined === value ? undefined : new Numeric(value)));
384
227
 
385
- lt(value: NumericValue) {
386
- return super.lt(new Numeric(value));
387
- }
228
+ lt = (value: NumericValue) => super.lt(new Numeric(value));
388
229
 
389
- lte(value: NumericValue) {
390
- return super.lte(new Numeric(value));
391
- }
230
+ lte = (value: NumericValue) => super.lte(new Numeric(value));
392
231
 
393
- minus(value: NumericValue) {
394
- return new Numeric(super.minus(new Numeric(value)));
395
- }
232
+ minus = (value: NumericValue) => new Numeric(super.minus(new Numeric(value)));
396
233
 
397
- mod(value: NumericValue) {
398
- return new Numeric(super.mod(new Numeric(value)));
399
- }
234
+ mod = (value: NumericValue) => new Numeric(super.mod(new Numeric(value)));
400
235
 
401
- modulo(value: NumericValue) {
402
- return new Numeric(super.modulo(new Numeric(value)));
403
- }
236
+ modulo = (value: NumericValue) => new Numeric(super.modulo(new Numeric(value)));
404
237
 
405
- mul(value: NumericValue) {
406
- return new Numeric(super.mul(new Numeric(value)));
407
- }
238
+ mul = (value: NumericValue) => new Numeric(super.mul(new Numeric(value)));
408
239
 
409
- naturalExponential() {
410
- return new Numeric(super.naturalExponential());
411
- }
240
+ naturalExponential = () => new Numeric(super.naturalExponential());
412
241
 
413
- naturalLogarithm() {
414
- return new Numeric(super.naturalLogarithm());
415
- }
242
+ naturalLogarithm = () => new Numeric(super.naturalLogarithm());
416
243
 
417
- neg() {
418
- return new Numeric(super.neg());
419
- }
244
+ neg = () => new Numeric(super.neg());
420
245
 
421
- negated() {
422
- return new Numeric(super.negated());
423
- }
246
+ negated = () => new Numeric(super.negated());
424
247
 
425
- plus(value: NumericValue) {
426
- return new Numeric(super.plus(new Numeric(value)));
427
- }
248
+ plus = (value: NumericValue) => new Numeric(super.plus(new Numeric(value)));
428
249
 
429
- pow(value: NumericValue) {
430
- return new Numeric(super.pow(new Numeric(value)));
431
- }
250
+ pow = (value: NumericValue) => new Numeric(super.pow(new Numeric(value)));
432
251
 
433
- round() {
434
- return new Numeric(super.round());
435
- }
252
+ round = () => new Numeric(super.round());
436
253
 
437
- sin() {
438
- return new Numeric(super.sin());
439
- }
254
+ sin = () => new Numeric(super.sin());
440
255
 
441
- sine() {
442
- return new Numeric(super.sine());
443
- }
256
+ sine = () => new Numeric(super.sine());
444
257
 
445
- sinh() {
446
- return new Numeric(super.sinh());
447
- }
258
+ sinh = () => new Numeric(super.sinh());
448
259
 
449
- sqrt() {
450
- return new Numeric(super.sqrt());
451
- }
260
+ sqrt = () => new Numeric(super.sqrt());
452
261
 
453
- squareRoot() {
454
- return new Numeric(super.squareRoot());
455
- }
262
+ squareRoot = () => new Numeric(super.squareRoot());
456
263
 
457
- sub(value: NumericValue) {
458
- return new Numeric(super.sub(new Numeric(value)));
459
- }
264
+ sub = (value: NumericValue) => new Numeric(super.sub(new Numeric(value)));
460
265
 
461
- tan() {
462
- return new Numeric(super.tan());
463
- }
266
+ tan = () => new Numeric(super.tan());
464
267
 
465
- tangent() {
466
- return new Numeric(super.tangent());
467
- }
268
+ tangent = () => new Numeric(super.tangent());
468
269
 
469
- tanh() {
470
- return new Numeric(super.tanh());
471
- }
270
+ tanh = () => new Numeric(super.tanh());
472
271
 
473
- times(value: NumericValue) {
474
- return new Numeric(super.times(new Numeric(value)));
475
- }
272
+ times = (value: NumericValue) => new Numeric(super.times(new Numeric(value)));
476
273
 
477
- toDP(decimalPlaces?: number, rounding?: Decimal.Rounding) {
478
- return new Numeric(
274
+ toDP = (decimalPlaces?: number, rounding?: Decimal.Rounding) =>
275
+ new Numeric(
479
276
  undefined !== rounding && undefined !== decimalPlaces
480
277
  ? super.toDP(decimalPlaces, rounding)
481
278
  : super.toDP(decimalPlaces)
482
279
  );
483
- }
484
280
 
485
- toDecimalPlaces(decimalPlaces?: number, rounding?: Decimal.Rounding) {
486
- return new Numeric(
281
+ toDecimalPlaces = (decimalPlaces?: number, rounding?: Decimal.Rounding) =>
282
+ new Numeric(
487
283
  undefined !== rounding && undefined !== decimalPlaces
488
284
  ? super.toDecimalPlaces(decimalPlaces, rounding)
489
285
  : super.toDecimalPlaces(decimalPlaces)
490
286
  );
491
- }
492
287
 
493
- toFraction(maxDenominator?: NumericValue) {
494
- return toNumerics(super.toFraction(undefined === maxDenominator ? undefined : new Numeric(maxDenominator)));
495
- }
288
+ toFraction = (maxDenominator?: NumericValue) =>
289
+ toNumerics(super.toFraction(undefined === maxDenominator ? undefined : new Numeric(maxDenominator)));
496
290
 
497
- toNearest(value: NumericValue, rounding?: Decimal.Rounding) {
498
- return new Numeric(super.toNearest(new Numeric(value), rounding));
499
- }
291
+ toNearest = (value: NumericValue, rounding?: Decimal.Rounding) =>
292
+ new Numeric(super.toNearest(new Numeric(value), rounding));
500
293
 
501
- toPower(value: NumericValue) {
502
- return new Numeric(super.toPower(new Numeric(value)));
503
- }
294
+ toPower = (value: NumericValue) => new Numeric(super.toPower(new Numeric(value)));
504
295
 
505
- toSD(decimalPlaces?: number, rounding?: Decimal.Rounding) {
506
- return new Numeric(
296
+ toSD = (decimalPlaces?: number, rounding?: Decimal.Rounding) =>
297
+ new Numeric(
507
298
  undefined !== rounding && undefined !== decimalPlaces
508
299
  ? super.toSD(decimalPlaces, rounding)
509
300
  : super.toSD(decimalPlaces)
510
301
  );
511
- }
512
302
 
513
- toSignificantDigits(decimalPlaces?: number, rounding?: Decimal.Rounding) {
514
- return new Numeric(
303
+ toSignificantDigits = (decimalPlaces?: number, rounding?: Decimal.Rounding) =>
304
+ new Numeric(
515
305
  undefined !== rounding && undefined !== decimalPlaces
516
306
  ? super.toSignificantDigits(decimalPlaces, rounding)
517
307
  : super.toSignificantDigits(decimalPlaces)
518
308
  );
519
- }
520
309
 
521
- trunc() {
522
- return new Numeric(super.trunc());
523
- }
310
+ trunc = () => new Numeric(super.trunc());
524
311
 
525
- truncated() {
526
- return new Numeric(super.truncated());
527
- }
312
+ truncated = () => new Numeric(super.truncated());
528
313
 
529
- inspect(depth: number, options: InspectOptionsStylized) {
314
+ inspect = (depth: number, options: InspectOptionsStylized) => {
530
315
  const value = this.toFixed();
531
316
  return isNode ? options.stylize(value, 'bigint') : value;
532
- }
317
+ };
533
318
  }
534
319
 
535
- export const toNumeric = (value: NumericValue) => {
536
- return new Numeric(value);
537
- };
320
+ export const toNumeric = (value: NumericValue) => new Numeric(value);
538
321
 
539
- export const toNumerics = (values: NumericValue[]) => {
540
- return values.map(toNumeric);
541
- };
322
+ export const toNumerics = (values: NumericValue[]) => values.map(toNumeric);
542
323
 
543
- export const toIntegerString = (value: NumericValue) => {
544
- return toNumeric(value).toFixed(0);
545
- };
324
+ export const toIntegerString = (value: NumericValue) => toNumeric(value).toFixed(0);
546
325
 
547
- export const toBigInt = (value: NumericValue) => {
548
- return BigInt(toIntegerString(value));
549
- };
326
+ export const toBigInt = (value: NumericValue) => BigInt(toIntegerString(value));
550
327
 
551
- export const toBN = (value: NumericValue) => {
552
- return new BN(toIntegerString(value));
553
- };
328
+ export const toBN = (value: NumericValue) => new BN(toIntegerString(value));
554
329
 
555
- export const toBigInteger = (value: NumericValue) => {
556
- return bigInt(toIntegerString(value));
557
- };
330
+ export const toBigInteger = (value: NumericValue) => bigInt(toIntegerString(value));
558
331
 
559
- export const toBigNumber = (value: NumericValue) => {
560
- return BigNumber.from(toIntegerString(value));
561
- };
332
+ export const toBigNumber = (value: NumericValue) => BigNumber.from(toIntegerString(value));
562
333
 
563
- export const createArrayCompareFunction = (ascending: boolean = true) => {
564
- //noinspection JSSuspiciousNameCombination
565
- return ascending
334
+ export const createArrayCompareFunction = (ascending: boolean = true) =>
335
+ ascending
566
336
  ? (left: NumericValue, right: NumericValue) => Numeric.sub(left, right).toNumber()
567
337
  : (left: NumericValue, right: NumericValue) => Numeric.sub(right, left).toNumber();
568
- };
569
338
 
570
339
  export const formatValue = (value: NumericValue, options?: IFormatNumberOptions) => {
571
340
  const format = formatter(options);
package/tsc-multi.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "targets": [
3
- { "extname": ".mjs", "module": "esnext" },
4
- { "extname": ".js", "module": "commonjs" }
5
- ]
3
+ { "extname": ".mjs", "module": "ESNext", "moduleResolution": "NodeNext" },
4
+ { "extname": ".js", "module": "CommonJS", "moduleResolution": "Node" }
5
+ ],
6
+ "projects": ["."]
6
7
  }