@fable-org/fable-library-js 2.0.0-beta.4 → 2.0.0-beta.5

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.
Files changed (97) hide show
  1. package/Array.js +56 -52
  2. package/Async.js +8 -7
  3. package/AsyncBuilder.js +6 -6
  4. package/BigInt.js +3 -3
  5. package/Boolean.js +2 -1
  6. package/CHANGELOG.md +8 -0
  7. package/Char.js +64 -31
  8. package/CollectionUtil.js +3 -3
  9. package/Date.js +50 -46
  10. package/DateOffset.js +38 -48
  11. package/DateOnly.js +6 -6
  12. package/Decimal.js +4 -4
  13. package/Double.js +2 -1
  14. package/FSharp.Collections.js +28 -10
  15. package/FSharp.Core.js +23 -23
  16. package/Global.js +21 -0
  17. package/Guid.js +5 -4
  18. package/Int32.js +17 -17
  19. package/List.js +36 -35
  20. package/Long.js +3 -2
  21. package/MailboxProcessor.js +2 -1
  22. package/Map.js +29 -27
  23. package/MapUtil.js +4 -4
  24. package/MutableMap.js +22 -10
  25. package/MutableSet.js +3 -3
  26. package/Option.js +3 -3
  27. package/Random.js +12 -11
  28. package/Range.js +2 -2
  29. package/Reflection.js +16 -16
  30. package/RegExp.js +4 -3
  31. package/Seq.js +31 -29
  32. package/Set.js +34 -33
  33. package/String.js +44 -35
  34. package/System.Collections.Generic.js +20 -4
  35. package/System.Text.js +3 -3
  36. package/System.js +283 -0
  37. package/TimeOnly.js +6 -6
  38. package/TimeSpan.js +5 -5
  39. package/Types.js +1 -17
  40. package/Uri.js +25 -19
  41. package/Util.js +31 -17
  42. package/package.json +1 -1
  43. package/Array.d.ts +0 -123
  44. package/Async.d.ts +0 -26
  45. package/AsyncBuilder.d.ts +0 -59
  46. package/BigInt.d.ts +0 -129
  47. package/BitConverter.d.ts +0 -27
  48. package/Boolean.d.ts +0 -3
  49. package/Char.d.ts +0 -65
  50. package/Choice.d.ts +0 -121
  51. package/CollectionUtil.d.ts +0 -7
  52. package/ConditionalWeakTable.d.ts +0 -9
  53. package/Date.d.ts +0 -69
  54. package/DateOffset.d.ts +0 -64
  55. package/DateOnly.d.ts +0 -18
  56. package/Decimal.d.ts +0 -63
  57. package/Double.d.ts +0 -11
  58. package/Encoding.d.ts +0 -12
  59. package/Event.d.ts +0 -31
  60. package/FSharp.Collections.d.ts +0 -7
  61. package/FSharp.Core.CompilerServices.d.ts +0 -12
  62. package/FSharp.Core.d.ts +0 -30
  63. package/Global.d.ts +0 -24
  64. package/Guid.d.ts +0 -10
  65. package/Int32.d.ts +0 -28
  66. package/List.d.ts +0 -143
  67. package/Long.d.ts +0 -3
  68. package/MailboxProcessor.d.ts +0 -25
  69. package/Map.d.ts +0 -178
  70. package/MapUtil.d.ts +0 -12
  71. package/MutableMap.d.ts +0 -52
  72. package/MutableSet.d.ts +0 -39
  73. package/Native.d.ts +0 -3
  74. package/Numeric.d.ts +0 -20
  75. package/Observable.d.ts +0 -32
  76. package/Option.d.ts +0 -29
  77. package/Random.d.ts +0 -37
  78. package/Range.d.ts +0 -12
  79. package/Reflection.d.ts +0 -119
  80. package/RegExp.d.ts +0 -10
  81. package/Result.d.ts +0 -37
  82. package/Seq.d.ts +0 -164
  83. package/Seq2.d.ts +0 -18
  84. package/Set.d.ts +0 -190
  85. package/String.d.ts +0 -58
  86. package/System.Collections.Generic.d.ts +0 -79
  87. package/System.Text.d.ts +0 -40
  88. package/SystemException.d.ts +0 -5
  89. package/SystemException.js +0 -5
  90. package/TimeOnly.d.ts +0 -15
  91. package/TimeSpan.d.ts +0 -35
  92. package/Timer.d.ts +0 -19
  93. package/Types.d.ts +0 -58
  94. package/Unicode.13.0.0.d.ts +0 -2
  95. package/Uri.d.ts +0 -31
  96. package/Util.d.ts +0 -212
  97. package/lib/big.d.ts +0 -5
package/String.js CHANGED
@@ -2,22 +2,31 @@ import { toString as dateToString } from "./Date.js";
2
2
  import { compare as numericCompare, isNumeric, isIntegral, multiply, toExponential, toFixed, toHex, toPrecision } from "./Numeric.js";
3
3
  import { escape } from "./RegExp.js";
4
4
  import { toString } from "./Types.js";
5
+ import { Exception } from "./Util.js";
5
6
  const fsFormatRegExp = /(^|[^%])%([0+\- ]*)(\*|\d+)?(?:\.(\d+))?(\w)/g;
6
7
  const interpolateRegExp = /(?:(^|[^%])%([0+\- ]*)(\d+)?(?:\.(\d+))?(\w))?%P\(\)/g;
7
8
  const formatRegExp = /\{(\d+)(,-?\d+)?(?:\:([a-zA-Z])(\d{0,2})|\:(.+?))?\}/g;
8
9
  function isLessThan(x, y) {
9
10
  return numericCompare(x, y) < 0;
10
11
  }
12
+ export const StringComparison = {
13
+ CurrentCulture: 0,
14
+ CurrentCultureIgnoreCase: 1,
15
+ InvariantCulture: 2,
16
+ InvariantCultureIgnoreCase: 3,
17
+ Ordinal: 4,
18
+ OrdinalIgnoreCase: 5,
19
+ };
11
20
  function cmp(x, y, ic) {
12
21
  function isIgnoreCase(i) {
13
22
  return i === true ||
14
- i === 1 /* StringComparison.CurrentCultureIgnoreCase */ ||
15
- i === 3 /* StringComparison.InvariantCultureIgnoreCase */ ||
16
- i === 5 /* StringComparison.OrdinalIgnoreCase */;
23
+ i === StringComparison.CurrentCultureIgnoreCase ||
24
+ i === StringComparison.InvariantCultureIgnoreCase ||
25
+ i === StringComparison.OrdinalIgnoreCase;
17
26
  }
18
27
  function isOrdinal(i) {
19
- return i === 4 /* StringComparison.Ordinal */ ||
20
- i === 5 /* StringComparison.OrdinalIgnoreCase */;
28
+ return i === StringComparison.Ordinal ||
29
+ i === StringComparison.OrdinalIgnoreCase;
21
30
  }
22
31
  if (x == null) {
23
32
  return y == null ? 0 : -1;
@@ -45,33 +54,33 @@ export function compare(...args) {
45
54
  case 2: return cmp(args[0], args[1], false);
46
55
  case 3: return cmp(args[0], args[1], args[2]);
47
56
  case 4: return cmp(args[0], args[1], args[2] === true);
48
- case 5: return cmp(args[0].substr(args[1], args[4]), args[2].substr(args[3], args[4]), false);
49
- case 6: return cmp(args[0].substr(args[1], args[4]), args[2].substr(args[3], args[4]), args[5]);
50
- case 7: return cmp(args[0].substr(args[1], args[4]), args[2].substr(args[3], args[4]), args[5] === true);
51
- default: throw new Error("String.compare: Unsupported number of parameters");
57
+ case 5: return cmp(args[0].slice(args[1], args[1] + args[4]), args[2].slice(args[3], args[3] + args[4]), false);
58
+ case 6: return cmp(args[0].slice(args[1], args[1] + args[4]), args[2].slice(args[3], args[3] + args[4]), args[5]);
59
+ case 7: return cmp(args[0].slice(args[1], args[1] + args[4]), args[2].slice(args[3], args[3] + args[4]), args[5] === true);
60
+ default: throw new Exception("String.compare: Unsupported number of parameters");
52
61
  }
53
62
  }
54
63
  export function compareOrdinal(x, y) {
55
- return cmp(x, y, 4 /* StringComparison.Ordinal */);
64
+ return cmp(x, y, StringComparison.Ordinal);
56
65
  }
57
66
  export function compareTo(x, y) {
58
- return cmp(x, y, 0 /* StringComparison.CurrentCulture */);
67
+ return cmp(x, y, StringComparison.CurrentCulture);
59
68
  }
60
69
  export function startsWith(str, pattern, ic) {
61
- if (ic === 4 /* StringComparison.Ordinal */) { // to avoid substring allocation
70
+ if (ic === StringComparison.Ordinal) { // to avoid substring allocation
62
71
  return str.startsWith(pattern);
63
72
  }
64
73
  if (str.length >= pattern.length) {
65
- return cmp(str.substr(0, pattern.length), pattern, ic) === 0;
74
+ return cmp(str.slice(0, pattern.length), pattern, ic) === 0;
66
75
  }
67
76
  return false;
68
77
  }
69
78
  export function endsWith(str, pattern, ic) {
70
- if (ic === 4 /* StringComparison.Ordinal */) { // to avoid substring allocation
79
+ if (ic === StringComparison.Ordinal) { // to avoid substring allocation
71
80
  return str.endsWith(pattern);
72
81
  }
73
82
  if (str.length >= pattern.length) {
74
- return cmp(str.substr(str.length - pattern.length, pattern.length), pattern, ic) === 0;
83
+ return cmp(str.slice(-pattern.length), pattern, ic) === 0;
75
84
  }
76
85
  return false;
77
86
  }
@@ -81,14 +90,14 @@ export function indexOfAny(str, anyOf, ...args) {
81
90
  }
82
91
  const startIndex = (args.length > 0) ? args[0] : 0;
83
92
  if (startIndex < 0) {
84
- throw new Error("Start index cannot be negative");
93
+ throw new Exception("Start index cannot be negative");
85
94
  }
86
95
  const length = (args.length > 1) ? args[1] : str.length - startIndex;
87
96
  if (length < 0) {
88
- throw new Error("Length cannot be negative");
97
+ throw new Exception("Length cannot be negative");
89
98
  }
90
99
  if (startIndex + length > str.length) {
91
- throw new Error("Invalid startIndex and length");
100
+ throw new Exception("Invalid startIndex and length");
92
101
  }
93
102
  const endIndex = startIndex + length;
94
103
  const anyOfAsStr = "".concat.apply("", anyOf);
@@ -143,7 +152,7 @@ export function toText(arg) {
143
152
  }
144
153
  export function toFail(arg) {
145
154
  return continuePrint((x) => {
146
- throw new Error(x);
155
+ throw new Exception(x);
147
156
  }, arg);
148
157
  }
149
158
  function formatReplacement(rep, flags, padLength, precision, format) {
@@ -230,7 +239,7 @@ function createPrinter(cont, _strParts, _matches, _result = "", padArg = -1) {
230
239
  }
231
240
  else if (padLength === "*") {
232
241
  if (arg < 0) {
233
- throw new Error("Non-negative number required");
242
+ throw new Exception("Non-negative number required");
234
243
  }
235
244
  padArg = arg;
236
245
  continue;
@@ -299,7 +308,7 @@ export function format(str, ...args) {
299
308
  }
300
309
  return str2.replace(formatRegExp, (_, idx, padLength, format, precision, pattern) => {
301
310
  if (idx < 0 || idx >= args.length) {
302
- throw new Error("Index must be greater or equal to zero and less than the arguments' length.");
311
+ throw new Exception("Index must be greater or equal to zero and less than the arguments' length.");
303
312
  }
304
313
  let rep = args[idx];
305
314
  let parts;
@@ -309,7 +318,7 @@ export function format(str, ...args) {
309
318
  case "b":
310
319
  case "B":
311
320
  if (!isIntegral(rep)) {
312
- throw new Error("Format specifier was invalid.");
321
+ throw new Exception("Format specifier was invalid.");
313
322
  }
314
323
  rep = (rep >>> 0).toString(2).replace(/^0+/, "").padStart(precision || 1, "0");
315
324
  break;
@@ -330,7 +339,7 @@ export function format(str, ...args) {
330
339
  case "d":
331
340
  case "D":
332
341
  if (!isIntegral(rep)) {
333
- throw new Error("Format specifier was invalid.");
342
+ throw new Exception("Format specifier was invalid.");
334
343
  }
335
344
  rep = String(rep);
336
345
  if (precision != null) {
@@ -377,11 +386,11 @@ export function format(str, ...args) {
377
386
  break;
378
387
  case "r":
379
388
  case "R":
380
- throw new Error("The round-trip format is not supported by Fable");
389
+ throw new Exception("The round-trip format is not supported by Fable");
381
390
  case "x":
382
391
  case "X":
383
392
  if (!isIntegral(rep)) {
384
- throw new Error("Format specifier was invalid.");
393
+ throw new Exception("Format specifier was invalid.");
385
394
  }
386
395
  precision = precision != null ? precision : 2;
387
396
  rep = padLeft(toHex(rep), precision, "0");
@@ -393,7 +402,7 @@ export function format(str, ...args) {
393
402
  // If we have format and were not able to handle it throw
394
403
  // See: https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings#standard-format-specifiers
395
404
  if (format) {
396
- throw new Error("Format specifier was invalid.");
405
+ throw new Exception("Format specifier was invalid.");
397
406
  }
398
407
  if (pattern) {
399
408
  let sign = "";
@@ -446,7 +455,7 @@ export function format(str, ...args) {
446
455
  }
447
456
  export function initialize(n, f) {
448
457
  if (n < 0) {
449
- throw new Error("String length must be non-negative");
458
+ throw new Exception("String length must be non-negative");
450
459
  }
451
460
  const xs = new Array(n);
452
461
  for (let i = 0; i < n; i++) {
@@ -456,7 +465,7 @@ export function initialize(n, f) {
456
465
  }
457
466
  export function insert(str, startIndex, value) {
458
467
  if (startIndex < 0 || startIndex > str.length) {
459
- throw new Error("startIndex is negative or greater than the length of this instance.");
468
+ throw new Exception("startIndex is negative or greater than the length of this instance.");
460
469
  }
461
470
  return str.substring(0, startIndex) + value + str.substring(startIndex);
462
471
  }
@@ -480,12 +489,12 @@ export function join(delimiter, xs) {
480
489
  export function joinWithIndices(delimiter, xs, startIndex, count) {
481
490
  const endIndexPlusOne = startIndex + count;
482
491
  if (endIndexPlusOne > xs.length) {
483
- throw new Error("Index and count must refer to a location within the buffer.");
492
+ throw new Exception("Index and count must refer to a location within the buffer.");
484
493
  }
485
494
  return xs.slice(startIndex, endIndexPlusOne).join(delimiter);
486
495
  }
487
496
  function notSupported(name) {
488
- throw new Error("The environment doesn't support '" + name + "', please use a polyfill.");
497
+ throw new Exception("The environment doesn't support '" + name + "', please use a polyfill.");
489
498
  }
490
499
  export function toBase64String(inArray) {
491
500
  let str = "";
@@ -518,10 +527,10 @@ export function padRight(str, len, ch) {
518
527
  }
519
528
  export function remove(str, startIndex, count) {
520
529
  if (startIndex >= str.length) {
521
- throw new Error("startIndex must be less than length of string");
530
+ throw new Exception("startIndex must be less than length of string");
522
531
  }
523
532
  if (typeof count === "number" && (startIndex + count) > str.length) {
524
- throw new Error("Index and count must refer to a location within the string.");
533
+ throw new Exception("Index and count must refer to a location within the string.");
525
534
  }
526
535
  return str.slice(0, startIndex) + (typeof count === "number" ? str.substr(startIndex + count) : "");
527
536
  }
@@ -533,7 +542,7 @@ export function replicate(n, x) {
533
542
  }
534
543
  export function getCharAtIndex(input, index) {
535
544
  if (index < 0 || index >= input.length) {
536
- throw new Error("Index was outside the bounds of the array.");
545
+ throw new Exception("Index was outside the bounds of the array.");
537
546
  }
538
547
  return input[index];
539
548
  }
@@ -541,7 +550,7 @@ export function split(str, splitters, count, options) {
541
550
  count = typeof count === "number" ? count : undefined;
542
551
  options = typeof options === "number" ? options : 0;
543
552
  if (count && count < 0) {
544
- throw new Error("Count cannot be less than zero");
553
+ throw new Exception("Count cannot be less than zero");
545
554
  }
546
555
  if (count === 0) {
547
556
  return [];
@@ -602,7 +611,7 @@ export function filter(pred, x) {
602
611
  }
603
612
  export function substring(str, startIndex, length) {
604
613
  if ((startIndex + (length || 0) > str.length)) {
605
- throw new Error("Invalid startIndex and/or length");
614
+ throw new Exception("Invalid startIndex and/or length");
606
615
  }
607
616
  return length != null ? str.substr(startIndex, length) : str.substr(startIndex);
608
617
  }
@@ -1,8 +1,24 @@
1
- import { disposeSafe, defaultOf, toIterator, getEnumerator, structuralHash, equals as equals_1, compare } from "./Util.js";
1
+ import { disposeSafe, defaultOf, toIterator, getEnumerator, structuralHash, equals as equals_1, compare, Exception } from "./Util.js";
2
2
  import { class_type } from "./Reflection.js";
3
+ import { SR_Arg_KeyNotFound } from "./Global.js";
3
4
  import { toArray, empty, singleton, append, enumerateWhile, delay } from "./Seq.js";
4
5
  import { setItem, initialize, copyTo, fill, item as item_1 } from "./Array.js";
5
6
  import { max } from "./Double.js";
7
+ import { ArgumentOutOfRangeException_$ctor_Z721C83C5 } from "./System.js";
8
+ export class KeyNotFoundException extends Exception {
9
+ constructor(message) {
10
+ super(message);
11
+ }
12
+ }
13
+ export function KeyNotFoundException_$reflection() {
14
+ return class_type("System.Collections.Generic.KeyNotFoundException", undefined, KeyNotFoundException, class_type("System.Exception"));
15
+ }
16
+ export function KeyNotFoundException_$ctor_Z721C83C5(message) {
17
+ return new KeyNotFoundException(message);
18
+ }
19
+ export function KeyNotFoundException_$ctor() {
20
+ return KeyNotFoundException_$ctor_Z721C83C5(SR_Arg_KeyNotFound);
21
+ }
6
22
  export class Comparer$1 {
7
23
  constructor(comparison) {
8
24
  this.comparison = comparison;
@@ -191,7 +207,7 @@ function Queue$1_$ctor_Z3B4C077E(initialContents, initialCount) {
191
207
  }
192
208
  export function Queue$1_$ctor_Z524259A4(initialCapacity) {
193
209
  if (initialCapacity < 0) {
194
- throw new Error("capacity is less than 0");
210
+ throw ArgumentOutOfRangeException_$ctor_Z721C83C5("capacity is less than 0");
195
211
  }
196
212
  return Queue$1_$ctor_Z3B4C077E(fill(new Array(initialCapacity), 0, initialCapacity, null), 0);
197
213
  }
@@ -215,7 +231,7 @@ export function Queue$1__Enqueue_2B595(_, value) {
215
231
  }
216
232
  export function Queue$1__Dequeue(_) {
217
233
  if (_.count === 0) {
218
- throw new Error("Queue is empty");
234
+ throw new Exception("Queue is empty");
219
235
  }
220
236
  const value = item_1(_.head, _.contents);
221
237
  _.head = (((_.head + 1) % Queue$1__size(_)) | 0);
@@ -224,7 +240,7 @@ export function Queue$1__Dequeue(_) {
224
240
  }
225
241
  export function Queue$1__Peek(_) {
226
242
  if (_.count === 0) {
227
- throw new Error("Queue is empty");
243
+ throw new Exception("Queue is empty");
228
244
  }
229
245
  return item_1(_.head, _.contents);
230
246
  }
package/System.Text.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { replace, format, replicate, substring, isNullOrEmpty, join } from "./String.js";
2
2
  import { class_type } from "./Reflection.js";
3
3
  import { toString } from "./Types.js";
4
- import { clear, int32ToString } from "./Util.js";
4
+ import { Exception, clear, int32ToString } from "./Util.js";
5
5
  export class StringBuilder {
6
6
  constructor(value, capacity) {
7
7
  this.buf = [];
@@ -123,7 +123,7 @@ export function StringBuilder__get_Chars_Z524259A4(x, index) {
123
123
  len = ((len + x.buf[i].length) | 0);
124
124
  }
125
125
  if (((index < 0) ? true : (i < 0)) ? true : (i >= x.buf.length)) {
126
- throw new Error("Index was outside the bounds of the array");
126
+ throw new Exception("Index was outside the bounds of the array");
127
127
  }
128
128
  else {
129
129
  const pos = ((len - index) - 1) | 0;
@@ -138,7 +138,7 @@ export function StringBuilder__set_Chars_413E0D0A(x, index, value) {
138
138
  len = ((len + x.buf[i].length) | 0);
139
139
  }
140
140
  if (((index < 0) ? true : (i < 0)) ? true : (i >= x.buf.length)) {
141
- throw new Error("Index was outside the bounds of the array");
141
+ throw new Exception("Index was outside the bounds of the array");
142
142
  }
143
143
  else {
144
144
  const pos = ((len - index) - 1) | 0;
package/System.js ADDED
@@ -0,0 +1,283 @@
1
+ import { Exception } from "./Util.js";
2
+ import { class_type } from "./Reflection.js";
3
+ import { SR_Arg_ArgumentOutOfRangeException, SR_ArgumentNull_Generic, SR_Arg_ArgumentException, SR_Arg_ParamName_Name, SR_Arg_TimeoutException, SR_Arg_StackOverflowException, SR_Arg_RankException, SR_Arg_OverflowException, SR_Arg_OutOfMemoryException, SR_Arg_NullReferenceException, SR_Arg_NotSupportedException, SR_Arg_NotImplementedException, SR_Arg_NotFiniteNumberException, SR_Arg_InvalidOperationException, SR_Arg_IndexOutOfRangeException, SR_Arg_FormatException, SR_Arg_DivideByZero, SR_Arg_ArithmeticException, SR_Arg_ApplicationException, SR_Arg_SystemException } from "./Global.js";
4
+ import { isNullOrEmpty } from "./String.js";
5
+ export class SystemException extends Exception {
6
+ constructor(message) {
7
+ super(message);
8
+ }
9
+ }
10
+ export function SystemException_$reflection() {
11
+ return class_type("System.SystemException", undefined, SystemException, class_type("System.Exception"));
12
+ }
13
+ export function SystemException_$ctor_Z721C83C5(message) {
14
+ return new SystemException(message);
15
+ }
16
+ export function SystemException_$ctor() {
17
+ return SystemException_$ctor_Z721C83C5(SR_Arg_SystemException);
18
+ }
19
+ export class ApplicationException extends Exception {
20
+ constructor(message) {
21
+ super(message);
22
+ }
23
+ }
24
+ export function ApplicationException_$reflection() {
25
+ return class_type("System.ApplicationException", undefined, ApplicationException, class_type("System.Exception"));
26
+ }
27
+ export function ApplicationException_$ctor_Z721C83C5(message) {
28
+ return new ApplicationException(message);
29
+ }
30
+ export function ApplicationException_$ctor() {
31
+ return ApplicationException_$ctor_Z721C83C5(SR_Arg_ApplicationException);
32
+ }
33
+ export class ArithmeticException extends Exception {
34
+ constructor(message) {
35
+ super(message);
36
+ }
37
+ }
38
+ export function ArithmeticException_$reflection() {
39
+ return class_type("System.ArithmeticException", undefined, ArithmeticException, class_type("System.Exception"));
40
+ }
41
+ export function ArithmeticException_$ctor_Z721C83C5(message) {
42
+ return new ArithmeticException(message);
43
+ }
44
+ export function ArithmeticException_$ctor() {
45
+ return ArithmeticException_$ctor_Z721C83C5(SR_Arg_ArithmeticException);
46
+ }
47
+ export class DivideByZeroException extends Exception {
48
+ constructor(message) {
49
+ super(message);
50
+ }
51
+ }
52
+ export function DivideByZeroException_$reflection() {
53
+ return class_type("System.DivideByZeroException", undefined, DivideByZeroException, class_type("System.Exception"));
54
+ }
55
+ export function DivideByZeroException_$ctor_Z721C83C5(message) {
56
+ return new DivideByZeroException(message);
57
+ }
58
+ export function DivideByZeroException_$ctor() {
59
+ return DivideByZeroException_$ctor_Z721C83C5(SR_Arg_DivideByZero);
60
+ }
61
+ export class FormatException extends Exception {
62
+ constructor(message) {
63
+ super(message);
64
+ }
65
+ }
66
+ export function FormatException_$reflection() {
67
+ return class_type("System.FormatException", undefined, FormatException, class_type("System.Exception"));
68
+ }
69
+ export function FormatException_$ctor_Z721C83C5(message) {
70
+ return new FormatException(message);
71
+ }
72
+ export function FormatException_$ctor() {
73
+ return FormatException_$ctor_Z721C83C5(SR_Arg_FormatException);
74
+ }
75
+ export class IndexOutOfRangeException extends Exception {
76
+ constructor(message) {
77
+ super(message);
78
+ }
79
+ }
80
+ export function IndexOutOfRangeException_$reflection() {
81
+ return class_type("System.IndexOutOfRangeException", undefined, IndexOutOfRangeException, class_type("System.Exception"));
82
+ }
83
+ export function IndexOutOfRangeException_$ctor_Z721C83C5(message) {
84
+ return new IndexOutOfRangeException(message);
85
+ }
86
+ export function IndexOutOfRangeException_$ctor() {
87
+ return IndexOutOfRangeException_$ctor_Z721C83C5(SR_Arg_IndexOutOfRangeException);
88
+ }
89
+ export class InvalidOperationException extends Exception {
90
+ constructor(message) {
91
+ super(message);
92
+ }
93
+ }
94
+ export function InvalidOperationException_$reflection() {
95
+ return class_type("System.InvalidOperationException", undefined, InvalidOperationException, class_type("System.Exception"));
96
+ }
97
+ export function InvalidOperationException_$ctor_Z721C83C5(message) {
98
+ return new InvalidOperationException(message);
99
+ }
100
+ export function InvalidOperationException_$ctor() {
101
+ return InvalidOperationException_$ctor_Z721C83C5(SR_Arg_InvalidOperationException);
102
+ }
103
+ export class NotFiniteNumberException extends Exception {
104
+ constructor(message) {
105
+ super(message);
106
+ }
107
+ }
108
+ export function NotFiniteNumberException_$reflection() {
109
+ return class_type("System.NotFiniteNumberException", undefined, NotFiniteNumberException, class_type("System.Exception"));
110
+ }
111
+ export function NotFiniteNumberException_$ctor_Z721C83C5(message) {
112
+ return new NotFiniteNumberException(message);
113
+ }
114
+ export function NotFiniteNumberException_$ctor() {
115
+ return NotFiniteNumberException_$ctor_Z721C83C5(SR_Arg_NotFiniteNumberException);
116
+ }
117
+ export class NotImplementedException extends Exception {
118
+ constructor(message) {
119
+ super(message);
120
+ }
121
+ }
122
+ export function NotImplementedException_$reflection() {
123
+ return class_type("System.NotImplementedException", undefined, NotImplementedException, class_type("System.Exception"));
124
+ }
125
+ export function NotImplementedException_$ctor_Z721C83C5(message) {
126
+ return new NotImplementedException(message);
127
+ }
128
+ export function NotImplementedException_$ctor() {
129
+ return NotImplementedException_$ctor_Z721C83C5(SR_Arg_NotImplementedException);
130
+ }
131
+ export class NotSupportedException extends Exception {
132
+ constructor(message) {
133
+ super(message);
134
+ }
135
+ }
136
+ export function NotSupportedException_$reflection() {
137
+ return class_type("System.NotSupportedException", undefined, NotSupportedException, class_type("System.Exception"));
138
+ }
139
+ export function NotSupportedException_$ctor_Z721C83C5(message) {
140
+ return new NotSupportedException(message);
141
+ }
142
+ export function NotSupportedException_$ctor() {
143
+ return NotSupportedException_$ctor_Z721C83C5(SR_Arg_NotSupportedException);
144
+ }
145
+ export class NullReferenceException extends Exception {
146
+ constructor(message) {
147
+ super(message);
148
+ }
149
+ }
150
+ export function NullReferenceException_$reflection() {
151
+ return class_type("System.NullReferenceException", undefined, NullReferenceException, class_type("System.Exception"));
152
+ }
153
+ export function NullReferenceException_$ctor_Z721C83C5(message) {
154
+ return new NullReferenceException(message);
155
+ }
156
+ export function NullReferenceException_$ctor() {
157
+ return NullReferenceException_$ctor_Z721C83C5(SR_Arg_NullReferenceException);
158
+ }
159
+ export class OutOfMemoryException extends Exception {
160
+ constructor(message) {
161
+ super(message);
162
+ }
163
+ }
164
+ export function OutOfMemoryException_$reflection() {
165
+ return class_type("System.OutOfMemoryException", undefined, OutOfMemoryException, class_type("System.Exception"));
166
+ }
167
+ export function OutOfMemoryException_$ctor_Z721C83C5(message) {
168
+ return new OutOfMemoryException(message);
169
+ }
170
+ export function OutOfMemoryException_$ctor() {
171
+ return OutOfMemoryException_$ctor_Z721C83C5(SR_Arg_OutOfMemoryException);
172
+ }
173
+ export class OverflowException extends Exception {
174
+ constructor(message) {
175
+ super(message);
176
+ }
177
+ }
178
+ export function OverflowException_$reflection() {
179
+ return class_type("System.OverflowException", undefined, OverflowException, class_type("System.Exception"));
180
+ }
181
+ export function OverflowException_$ctor_Z721C83C5(message) {
182
+ return new OverflowException(message);
183
+ }
184
+ export function OverflowException_$ctor() {
185
+ return OverflowException_$ctor_Z721C83C5(SR_Arg_OverflowException);
186
+ }
187
+ export class RankException extends Exception {
188
+ constructor(message) {
189
+ super(message);
190
+ }
191
+ }
192
+ export function RankException_$reflection() {
193
+ return class_type("System.RankException", undefined, RankException, class_type("System.Exception"));
194
+ }
195
+ export function RankException_$ctor_Z721C83C5(message) {
196
+ return new RankException(message);
197
+ }
198
+ export function RankException_$ctor() {
199
+ return RankException_$ctor_Z721C83C5(SR_Arg_RankException);
200
+ }
201
+ export class StackOverflowException extends Exception {
202
+ constructor(message) {
203
+ super(message);
204
+ }
205
+ }
206
+ export function StackOverflowException_$reflection() {
207
+ return class_type("System.StackOverflowException", undefined, StackOverflowException, class_type("System.Exception"));
208
+ }
209
+ export function StackOverflowException_$ctor_Z721C83C5(message) {
210
+ return new StackOverflowException(message);
211
+ }
212
+ export function StackOverflowException_$ctor() {
213
+ return StackOverflowException_$ctor_Z721C83C5(SR_Arg_StackOverflowException);
214
+ }
215
+ export class TimeoutException extends Exception {
216
+ constructor(message) {
217
+ super(message);
218
+ }
219
+ }
220
+ export function TimeoutException_$reflection() {
221
+ return class_type("System.TimeoutException", undefined, TimeoutException, class_type("System.Exception"));
222
+ }
223
+ export function TimeoutException_$ctor_Z721C83C5(message) {
224
+ return new TimeoutException(message);
225
+ }
226
+ export function TimeoutException_$ctor() {
227
+ return TimeoutException_$ctor_Z721C83C5(SR_Arg_TimeoutException);
228
+ }
229
+ export class ArgumentException extends Exception {
230
+ constructor(message, paramName) {
231
+ super(isNullOrEmpty(paramName) ? message : (((message + SR_Arg_ParamName_Name) + paramName) + "\')"));
232
+ this.paramName = paramName;
233
+ }
234
+ }
235
+ export function ArgumentException_$reflection() {
236
+ return class_type("System.ArgumentException", undefined, ArgumentException, class_type("System.Exception"));
237
+ }
238
+ export function ArgumentException_$ctor_Z384F8060(message, paramName) {
239
+ return new ArgumentException(message, paramName);
240
+ }
241
+ export function ArgumentException_$ctor() {
242
+ return ArgumentException_$ctor_Z384F8060(SR_Arg_ArgumentException, "");
243
+ }
244
+ export function ArgumentException_$ctor_Z721C83C5(message) {
245
+ return ArgumentException_$ctor_Z384F8060(message, "");
246
+ }
247
+ export function ArgumentException__get_ParamName(_) {
248
+ return _.paramName;
249
+ }
250
+ export class ArgumentNullException extends ArgumentException {
251
+ constructor(paramName, message) {
252
+ super(message, paramName);
253
+ }
254
+ }
255
+ export function ArgumentNullException_$reflection() {
256
+ return class_type("System.ArgumentNullException", undefined, ArgumentNullException, ArgumentException_$reflection());
257
+ }
258
+ export function ArgumentNullException_$ctor_Z384F8060(paramName, message) {
259
+ return new ArgumentNullException(paramName, message);
260
+ }
261
+ export function ArgumentNullException_$ctor_Z721C83C5(paramName) {
262
+ return ArgumentNullException_$ctor_Z384F8060(paramName, SR_ArgumentNull_Generic);
263
+ }
264
+ export function ArgumentNullException_$ctor() {
265
+ return ArgumentNullException_$ctor_Z721C83C5("");
266
+ }
267
+ export class ArgumentOutOfRangeException extends ArgumentException {
268
+ constructor(paramName, message) {
269
+ super(message, paramName);
270
+ }
271
+ }
272
+ export function ArgumentOutOfRangeException_$reflection() {
273
+ return class_type("System.ArgumentOutOfRangeException", undefined, ArgumentOutOfRangeException, ArgumentException_$reflection());
274
+ }
275
+ export function ArgumentOutOfRangeException_$ctor_Z384F8060(paramName, message) {
276
+ return new ArgumentOutOfRangeException(paramName, message);
277
+ }
278
+ export function ArgumentOutOfRangeException_$ctor_Z721C83C5(paramName) {
279
+ return ArgumentOutOfRangeException_$ctor_Z384F8060(paramName, SR_Arg_ArgumentOutOfRangeException);
280
+ }
281
+ export function ArgumentOutOfRangeException_$ctor() {
282
+ return ArgumentOutOfRangeException_$ctor_Z721C83C5("");
283
+ }
package/TimeOnly.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { hours, minutes, seconds, milliseconds } from "./TimeSpan.js";
2
- import { padWithZeros } from "./Util.js";
2
+ import { Exception, DateTimeKind, padWithZeros } from "./Util.js";
3
3
  const millisecondsPerDay = 86400000;
4
4
  export function create(h = 0, m = 0, s = 0, ms = 0) {
5
5
  if (h < 0 || m < 0 || s < 0 || ms < 0)
6
- throw new Error("The parameters describe an unrepresentable TimeOnly.");
6
+ throw new Exception("The parameters describe an unrepresentable TimeOnly.");
7
7
  return h * 3600000 + m * 60000 + s * 1000 + ms;
8
8
  }
9
9
  export function fromTicks(ticks) {
@@ -11,11 +11,11 @@ export function fromTicks(ticks) {
11
11
  }
12
12
  export function fromTimeSpan(timeSpan) {
13
13
  if (timeSpan < 0 || timeSpan >= millisecondsPerDay)
14
- throw new Error("The TimeSpan describes an unrepresentable TimeOnly.");
14
+ throw new Exception("The TimeSpan describes an unrepresentable TimeOnly.");
15
15
  return timeSpan;
16
16
  }
17
17
  export function fromDateTime(d) {
18
- return d.kind === 1 /* DateKind.UTC */
18
+ return d.kind === DateTimeKind.Utc
19
19
  ? create(d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds(), d.getUTCMilliseconds())
20
20
  : create(d.getHours(), d.getMinutes(), d.getSeconds(), d.getMilliseconds());
21
21
  }
@@ -55,7 +55,7 @@ export function isBetween(t, start, end) {
55
55
  }
56
56
  export function toString(t, format = "t", _provider) {
57
57
  if (["r", "R", "o", "O", "t", "T"].indexOf(format) === -1) {
58
- throw new Error("Custom formats are not supported");
58
+ throw new Exception("Custom formats are not supported");
59
59
  }
60
60
  const base = `${padWithZeros(hours(t), 2)}:${padWithZeros(minutes(t), 2)}`;
61
61
  if (format === "t")
@@ -106,7 +106,7 @@ export function parse(str) {
106
106
  }
107
107
  return create(h, m, s, Math.trunc(ms));
108
108
  }
109
- throw new Error(`String '${str}' was not recognized as a valid TimeOnly.`);
109
+ throw new Exception(`String '${str}' was not recognized as a valid TimeOnly.`);
110
110
  }
111
111
  export function tryParse(v, defValue) {
112
112
  try {