@fable-org/fable-library-js 2.0.0-beta.3 → 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 (98) hide show
  1. package/Array.js +64 -60
  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 +12 -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 +19 -19
  16. package/Global.js +21 -0
  17. package/Guid.js +5 -4
  18. package/Int32.js +17 -17
  19. package/List.js +74 -63
  20. package/Long.js +3 -2
  21. package/MailboxProcessor.js +2 -1
  22. package/Map.js +39 -42
  23. package/MapUtil.js +4 -4
  24. package/MutableMap.js +22 -10
  25. package/MutableSet.js +3 -3
  26. package/Native.js +9 -3
  27. package/Option.js +10 -2
  28. package/Random.js +13 -12
  29. package/Range.js +2 -2
  30. package/Reflection.js +16 -16
  31. package/RegExp.js +4 -3
  32. package/Seq.js +38 -46
  33. package/Set.js +41 -42
  34. package/String.js +44 -35
  35. package/System.Collections.Generic.js +22 -6
  36. package/System.Text.js +8 -8
  37. package/System.js +283 -0
  38. package/TimeOnly.js +6 -6
  39. package/TimeSpan.js +5 -5
  40. package/Types.js +1 -17
  41. package/Uri.js +25 -19
  42. package/Util.js +32 -9
  43. package/package.json +23 -23
  44. package/Array.d.ts +0 -123
  45. package/Async.d.ts +0 -26
  46. package/AsyncBuilder.d.ts +0 -59
  47. package/BigInt.d.ts +0 -129
  48. package/BitConverter.d.ts +0 -27
  49. package/Boolean.d.ts +0 -3
  50. package/Char.d.ts +0 -65
  51. package/Choice.d.ts +0 -121
  52. package/CollectionUtil.d.ts +0 -7
  53. package/ConditionalWeakTable.d.ts +0 -9
  54. package/Date.d.ts +0 -69
  55. package/DateOffset.d.ts +0 -64
  56. package/DateOnly.d.ts +0 -18
  57. package/Decimal.d.ts +0 -63
  58. package/Double.d.ts +0 -11
  59. package/Encoding.d.ts +0 -12
  60. package/Event.d.ts +0 -31
  61. package/FSharp.Collections.d.ts +0 -7
  62. package/FSharp.Core.CompilerServices.d.ts +0 -12
  63. package/FSharp.Core.d.ts +0 -31
  64. package/Global.d.ts +0 -24
  65. package/Guid.d.ts +0 -10
  66. package/Int32.d.ts +0 -28
  67. package/List.d.ts +0 -143
  68. package/Long.d.ts +0 -3
  69. package/MailboxProcessor.d.ts +0 -25
  70. package/Map.d.ts +0 -178
  71. package/MapUtil.d.ts +0 -12
  72. package/MutableMap.d.ts +0 -52
  73. package/MutableSet.d.ts +0 -39
  74. package/Native.d.ts +0 -2
  75. package/Numeric.d.ts +0 -20
  76. package/Observable.d.ts +0 -32
  77. package/Option.d.ts +0 -28
  78. package/Random.d.ts +0 -37
  79. package/Range.d.ts +0 -12
  80. package/Reflection.d.ts +0 -119
  81. package/RegExp.d.ts +0 -10
  82. package/Result.d.ts +0 -37
  83. package/Seq.d.ts +0 -165
  84. package/Seq2.d.ts +0 -18
  85. package/Set.d.ts +0 -190
  86. package/String.d.ts +0 -58
  87. package/System.Collections.Generic.d.ts +0 -79
  88. package/System.Text.d.ts +0 -39
  89. package/SystemException.d.ts +0 -5
  90. package/SystemException.js +0 -5
  91. package/TimeOnly.d.ts +0 -15
  92. package/TimeSpan.d.ts +0 -35
  93. package/Timer.d.ts +0 -19
  94. package/Types.d.ts +0 -58
  95. package/Unicode.13.0.0.d.ts +0 -2
  96. package/Uri.d.ts +0 -31
  97. package/Util.d.ts +0 -210
  98. package/lib/big.d.ts +0 -5
package/FSharp.Core.js CHANGED
@@ -1,22 +1,22 @@
1
- import { disposeSafe, defaultOf, structuralHash, equals } from "./Util.js";
1
+ import { disposeSafe, defaultOf, Exception, structuralHash, equals } from "./Util.js";
2
2
  import { HashIdentity_Structural, ComparisonIdentity_Structural } from "./FSharp.Collections.js";
3
- import { value as value_1 } from "./Option.js";
3
+ import { nonNullValue } from "./Option.js";
4
+ import { NullReferenceException_$ctor, ArgumentNullException_$ctor_Z721C83C5 } from "./System.js";
4
5
  import { FSharpChoice$2_Choice2Of2, FSharpChoice$2_Choice1Of2 } from "./Choice.js";
5
- import { concat } from "./String.js";
6
6
  import { StringBuilder__Append_Z721C83C5 } from "./System.Text.js";
7
7
  export const LanguagePrimitives_GenericEqualityComparer = {
8
- "System.Collections.IEqualityComparer.Equals541DA560"(x, y) {
8
+ Equals(x, y) {
9
9
  return equals(x, y);
10
10
  },
11
- "System.Collections.IEqualityComparer.GetHashCode4E60E31B"(x_1) {
11
+ GetHashCode(x_1) {
12
12
  return structuralHash(x_1) | 0;
13
13
  },
14
14
  };
15
15
  export const LanguagePrimitives_GenericEqualityERComparer = {
16
- "System.Collections.IEqualityComparer.Equals541DA560"(x, y) {
16
+ Equals(x, y) {
17
17
  return equals(x, y);
18
18
  },
19
- "System.Collections.IEqualityComparer.GetHashCode4E60E31B"(x_1) {
19
+ GetHashCode(x_1) {
20
20
  return structuralHash(x_1) | 0;
21
21
  },
22
22
  };
@@ -33,13 +33,13 @@ export function LanguagePrimitives_FastGenericEqualityComparerFromTable() {
33
33
  return HashIdentity_Structural();
34
34
  }
35
35
  export function Operators_Failure(message) {
36
- return new Error(message);
36
+ return new Exception(message);
37
37
  }
38
38
  export function Operators_FailurePattern(exn) {
39
39
  return exn.message;
40
40
  }
41
- export function Operators_NullArg(x) {
42
- throw new Error(x);
41
+ export function Operators_NullArg(argumentName) {
42
+ throw ArgumentNullException_$ctor_Z721C83C5(argumentName);
43
43
  }
44
44
  export function Operators_Using(resource, action) {
45
45
  try {
@@ -78,7 +78,7 @@ export function Operators_IsNullV(value) {
78
78
  }
79
79
  export function Operators_NonNull(value) {
80
80
  if (equals(value, defaultOf())) {
81
- throw new Error();
81
+ throw NullReferenceException_$ctor();
82
82
  }
83
83
  else {
84
84
  return value;
@@ -86,10 +86,10 @@ export function Operators_NonNull(value) {
86
86
  }
87
87
  export function Operators_NonNullV(value) {
88
88
  if (value != null) {
89
- return value_1(value);
89
+ return nonNullValue(value);
90
90
  }
91
91
  else {
92
- throw new Error();
92
+ throw NullReferenceException_$ctor();
93
93
  }
94
94
  }
95
95
  export function Operators_NullMatchPattern(value) {
@@ -102,7 +102,7 @@ export function Operators_NullMatchPattern(value) {
102
102
  }
103
103
  export function Operators_NullValueMatchPattern(value) {
104
104
  if (value != null) {
105
- return FSharpChoice$2_Choice2Of2(value_1(value));
105
+ return FSharpChoice$2_Choice2Of2(nonNullValue(value));
106
106
  }
107
107
  else {
108
108
  return FSharpChoice$2_Choice1Of2(undefined);
@@ -110,7 +110,7 @@ export function Operators_NullValueMatchPattern(value) {
110
110
  }
111
111
  export function Operators_NonNullQuickPattern(value) {
112
112
  if (equals(value, defaultOf())) {
113
- throw new Error();
113
+ throw NullReferenceException_$ctor();
114
114
  }
115
115
  else {
116
116
  return value;
@@ -118,10 +118,10 @@ export function Operators_NonNullQuickPattern(value) {
118
118
  }
119
119
  export function Operators_NonNullQuickValuePattern(value) {
120
120
  if (value != null) {
121
- return value_1(value);
121
+ return nonNullValue(value);
122
122
  }
123
123
  else {
124
- throw new Error();
124
+ throw NullReferenceException_$ctor();
125
125
  }
126
126
  }
127
127
  export function Operators_WithNull(value) {
@@ -131,11 +131,11 @@ export function Operators_WithNullV(value) {
131
131
  return value;
132
132
  }
133
133
  export function Operators_NullV() {
134
- return defaultOf();
134
+ return null;
135
135
  }
136
136
  export function Operators_NullArgCheck(argumentName, value) {
137
137
  if (equals(value, defaultOf())) {
138
- throw new Error(concat("Value cannot be null. (Parameter \'", argumentName, ..."\')"));
138
+ throw ArgumentNullException_$ctor_Z721C83C5(argumentName);
139
139
  }
140
140
  else {
141
141
  return value;
package/Global.js CHANGED
@@ -6,3 +6,24 @@ export const SR_inputSequenceTooLong = "The input sequence contains more than on
6
6
  export const SR_keyNotFoundAlt = "An index satisfying the predicate was not found in the collection.";
7
7
  export const SR_differentLengths = "The collections had different lengths.";
8
8
  export const SR_notEnoughElements = "The input sequence has an insufficient number of elements.";
9
+ export const SR_Arg_ApplicationException = "Error in the application.";
10
+ export const SR_Arg_ArgumentException = "Value does not fall within the expected range.";
11
+ export const SR_Arg_ArgumentOutOfRangeException = "Specified argument was out of the range of valid values.";
12
+ export const SR_ArgumentNull_Generic = "Value cannot be null.";
13
+ export const SR_Arg_ParamName_Name = " (Parameter \'";
14
+ export const SR_Arg_ArithmeticException = "Overflow or underflow in the arithmetic operation.";
15
+ export const SR_Arg_DivideByZero = "Attempted to divide by zero.";
16
+ export const SR_Arg_FormatException = "One of the identified items was in an invalid format.";
17
+ export const SR_Arg_IndexOutOfRangeException = "Index was outside the bounds of the array.";
18
+ export const SR_Arg_InvalidOperationException = "Operation is not valid due to the current state of the object.";
19
+ export const SR_Arg_KeyNotFound = "The given key was not present in the dictionary.";
20
+ export const SR_Arg_NotFiniteNumberException = "Number encountered was not a finite quantity.";
21
+ export const SR_Arg_NotImplementedException = "The method or operation is not implemented.";
22
+ export const SR_Arg_NotSupportedException = "Specified method is not supported.";
23
+ export const SR_Arg_NullReferenceException = "Object reference not set to an instance of an object.";
24
+ export const SR_Arg_OutOfMemoryException = "Insufficient memory to continue the execution of the program.";
25
+ export const SR_Arg_OverflowException = "Arithmetic operation resulted in an overflow.";
26
+ export const SR_Arg_RankException = "Attempted to operate on an array with the incorrect number of dimensions.";
27
+ export const SR_Arg_StackOverflowException = "Operation caused a stack overflow.";
28
+ export const SR_Arg_SystemException = "System error.";
29
+ export const SR_Arg_TimeoutException = "The operation has timed out.";
package/Guid.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { trim } from "./String.js";
2
+ import { Exception } from "./Util.js";
2
3
  // RFC 4122 compliant. From https://stackoverflow.com/a/13653180/3922220
3
4
  // const guidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
4
5
  // Relax GUID parsing, see #1637
@@ -20,7 +21,7 @@ export function toString(str, format, _provider) {
20
21
  case "X":
21
22
  return str.replace(guidHexCaptures, "{0x$1,0x$3,0x$5,{0x$6,0x$7,0x$8,0x$9,0x$10,0x$11,0x$12,0x$13}}");
22
23
  default:
23
- throw new Error("Unrecognized Guid print format");
24
+ throw new Exception("Unrecognized Guid print format");
24
25
  }
25
26
  }
26
27
  else {
@@ -43,7 +44,7 @@ export function parse(str) {
43
44
  return hyphenateGuid(wsTrimAndLowered.replace(/[\{\},]|0x/g, ''));
44
45
  }
45
46
  else {
46
- throw new Error("Guid should contain 32 digits with 4 dashes: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx");
47
+ throw new Exception("Guid should contain 32 digits with 4 dashes: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx");
47
48
  }
48
49
  }
49
50
  export function tryParse(str, defValue) {
@@ -73,7 +74,7 @@ function initConvertMaps() {
73
74
  _byteToHex = new Array(256);
74
75
  _hexToByte = {};
75
76
  for (let i = 0; i < 256; i++) {
76
- _byteToHex[i] = (i + 0x100).toString(16).substr(1);
77
+ _byteToHex[i] = i.toString(16).padStart(2, '0');
77
78
  _hexToByte[_byteToHex[i]] = i;
78
79
  }
79
80
  _convertMapsInitialized = true;
@@ -125,7 +126,7 @@ export function guidToArray(s) {
125
126
  /** Convert UUID byte array into a string */
126
127
  export function arrayToGuid(buf) {
127
128
  if (buf.length !== 16) {
128
- throw new Error("Byte array for GUID must be exactly 16 bytes long");
129
+ throw new Exception("Byte array for GUID must be exactly 16 bytes long");
129
130
  }
130
131
  if (!_convertMapsInitialized) {
131
132
  initConvertMaps();
package/Int32.js CHANGED
@@ -1,16 +1,16 @@
1
- export var NumberStyles;
2
- (function (NumberStyles) {
3
- // None = 0x00000000,
4
- // AllowLeadingWhite = 0x00000001,
5
- // AllowTrailingWhite = 0x00000002,
6
- // AllowLeadingSign = 0x00000004,
7
- // AllowTrailingSign = 0x00000008,
8
- // AllowParentheses = 0x00000010,
9
- // AllowDecimalPoint = 0x00000020,
10
- // AllowThousands = 0x00000040,
11
- // AllowExponent = 0x00000080,
12
- // AllowCurrencySymbol = 0x00000100,
13
- NumberStyles[NumberStyles["AllowHexSpecifier"] = 512] = "AllowHexSpecifier";
1
+ import { Exception } from "./Util.js";
2
+ export const NumberStyles = {
3
+ // None: 0x00000000,
4
+ // AllowLeadingWhite: 0x00000001,
5
+ // AllowTrailingWhite: 0x00000002,
6
+ // AllowLeadingSign: 0x00000004,
7
+ // AllowTrailingSign: 0x00000008,
8
+ // AllowParentheses: 0x00000010,
9
+ // AllowDecimalPoint: 0x00000020,
10
+ // AllowThousands: 0x00000040,
11
+ // AllowExponent: 0x00000080,
12
+ // AllowCurrencySymbol: 0x00000100,
13
+ AllowHexSpecifier: 0x00000200,
14
14
  // Integer = AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign,
15
15
  // HexNumber = AllowLeadingWhite | AllowTrailingWhite | AllowHexSpecifier,
16
16
  // Number = AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign |
@@ -21,7 +21,7 @@ export var NumberStyles;
21
21
  // AllowParentheses | AllowDecimalPoint | AllowThousands | AllowCurrencySymbol,
22
22
  // Any = AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign | AllowTrailingSign |
23
23
  // AllowParentheses | AllowDecimalPoint | AllowThousands | AllowCurrencySymbol | AllowExponent,
24
- })(NumberStyles || (NumberStyles = {}));
24
+ };
25
25
  function validResponse(regexMatch, radix) {
26
26
  const [/*all*/ , sign, prefix, digits] = regexMatch;
27
27
  return {
@@ -36,7 +36,7 @@ function getRange(unsigned, bitsize) {
36
36
  case 8: return unsigned ? [0, 255] : [-128, 127];
37
37
  case 16: return unsigned ? [0, 65535] : [-32768, 32767];
38
38
  case 32: return unsigned ? [0, 4294967295] : [-2147483648, 2147483647];
39
- default: throw new Error("Invalid bit size.");
39
+ default: throw new Exception("Invalid bit size.");
40
40
  }
41
41
  }
42
42
  function getInvalidDigits(radix) {
@@ -46,7 +46,7 @@ function getInvalidDigits(radix) {
46
46
  case 10: return /[^0-9]/;
47
47
  case 16: return /[^0-9a-fA-F]/;
48
48
  default:
49
- throw new Error("Invalid Base.");
49
+ throw new Exception("Invalid Base.");
50
50
  }
51
51
  }
52
52
  export function getPrefix(radix) {
@@ -102,7 +102,7 @@ export function parse(str, style, unsigned, bitsize, radix) {
102
102
  }
103
103
  }
104
104
  }
105
- throw new Error(`The input string ${str} was not in a correct format.`);
105
+ throw new Exception(`The input string ${str} was not in a correct format.`);
106
106
  }
107
107
  export function tryParse(str, style, unsigned, bitsize, defValue) {
108
108
  try {
package/List.js CHANGED
@@ -1,9 +1,10 @@
1
1
  import { join } from "./String.js";
2
2
  import { defaultArg, some, value as value_1 } from "./Option.js";
3
- import { disposeSafe, isArrayLike, defaultOf, toIterator, getEnumerator, compare, structuralHash, equals } from "./Util.js";
3
+ import { disposeSafe, isArrayLike, Exception, defaultOf, toIterator, getEnumerator, compare, structuralHash, equals } from "./Util.js";
4
4
  import { Record } from "./Types.js";
5
5
  import { class_type, record_type, option_type } from "./Reflection.js";
6
6
  import { SR_inputSequenceTooLong, SR_inputSequenceEmpty, SR_inputMustBeNonNegative, SR_notEnoughElements, SR_differentLengths, SR_keyNotFoundAlt, SR_indexOutOfBounds, SR_inputWasEmpty } from "./Global.js";
7
+ import { KeyNotFoundException_$ctor_Z721C83C5 } from "./System.Collections.Generic.js";
7
8
  import { transpose as transpose_1, splitInto as splitInto_1, windowed as windowed_1, pairwise as pairwise_1, chunkBySize as chunkBySize_1, map as map_1, permute as permute_1, tryFindIndexBack as tryFindIndexBack_1, tryFindBack as tryFindBack_1, scanBack as scanBack_1, item as item_1, foldBack2 as foldBack2_1, foldBack as foldBack_1, setItem, fill } from "./Array.js";
8
9
  export class FSharpList extends Record {
9
10
  constructor(head, tail) {
@@ -20,7 +21,8 @@ export class FSharpList extends Record {
20
21
  if (xs === other) {
21
22
  return true;
22
23
  }
23
- else {
24
+ else if (other instanceof FSharpList) {
25
+ const ys = other;
24
26
  const loop = (xs_1_mut, ys_1_mut) => {
25
27
  loop: while (true) {
26
28
  const xs_1 = xs_1_mut, ys_1 = ys_1_mut;
@@ -52,7 +54,10 @@ export class FSharpList extends Record {
52
54
  break;
53
55
  }
54
56
  };
55
- return loop(xs, other);
57
+ return loop(xs, ys);
58
+ }
59
+ else {
60
+ return false;
56
61
  }
57
62
  }
58
63
  GetHashCode() {
@@ -87,39 +92,45 @@ export class FSharpList extends Record {
87
92
  }
88
93
  CompareTo(other) {
89
94
  const xs = this;
90
- const loop = (xs_1_mut, ys_1_mut) => {
91
- loop: while (true) {
92
- const xs_1 = xs_1_mut, ys_1 = ys_1_mut;
93
- const matchValue = xs_1.tail;
94
- const matchValue_1 = ys_1.tail;
95
- if (matchValue != null) {
96
- if (matchValue_1 != null) {
97
- const xt = value_1(matchValue);
98
- const yt = value_1(matchValue_1);
99
- const c = compare(xs_1.head, ys_1.head) | 0;
100
- if (c === 0) {
101
- xs_1_mut = xt;
102
- ys_1_mut = yt;
103
- continue loop;
95
+ if (other instanceof FSharpList) {
96
+ const ys = other;
97
+ const loop = (xs_1_mut, ys_1_mut) => {
98
+ loop: while (true) {
99
+ const xs_1 = xs_1_mut, ys_1 = ys_1_mut;
100
+ const matchValue = xs_1.tail;
101
+ const matchValue_1 = ys_1.tail;
102
+ if (matchValue != null) {
103
+ if (matchValue_1 != null) {
104
+ const xt = value_1(matchValue);
105
+ const yt = value_1(matchValue_1);
106
+ const c = compare(xs_1.head, ys_1.head) | 0;
107
+ if (c === 0) {
108
+ xs_1_mut = xt;
109
+ ys_1_mut = yt;
110
+ continue loop;
111
+ }
112
+ else {
113
+ return c | 0;
114
+ }
104
115
  }
105
116
  else {
106
- return c | 0;
117
+ return 1;
107
118
  }
108
119
  }
120
+ else if (matchValue_1 != null) {
121
+ return -1;
122
+ }
109
123
  else {
110
- return 1;
124
+ return 0;
111
125
  }
126
+ break;
112
127
  }
113
- else if (matchValue_1 != null) {
114
- return -1;
115
- }
116
- else {
117
- return 0;
118
- }
119
- break;
120
- }
121
- };
122
- return loop(xs, other) | 0;
128
+ };
129
+ return loop(xs, ys) | 0;
130
+ }
131
+ else {
132
+ return 1;
133
+ }
123
134
  }
124
135
  GetEnumerator() {
125
136
  const xs = this;
@@ -210,7 +221,7 @@ export function FSharpList__get_Head(xs) {
210
221
  return xs.head;
211
222
  }
212
223
  else {
213
- throw new Error((SR_inputWasEmpty + "\\nParameter name: ") + "list");
224
+ throw new Exception((SR_inputWasEmpty + "\\nParameter name: ") + "list");
214
225
  }
215
226
  }
216
227
  export function FSharpList__get_Tail(xs) {
@@ -219,7 +230,7 @@ export function FSharpList__get_Tail(xs) {
219
230
  return value_1(matchValue);
220
231
  }
221
232
  else {
222
- throw new Error((SR_inputWasEmpty + "\\nParameter name: ") + "list");
233
+ throw new Exception((SR_inputWasEmpty + "\\nParameter name: ") + "list");
223
234
  }
224
235
  }
225
236
  export function FSharpList__get_Item_Z524259A4(xs, index) {
@@ -238,7 +249,7 @@ export function FSharpList__get_Item_Z524259A4(xs, index) {
238
249
  }
239
250
  }
240
251
  else {
241
- throw new Error((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
252
+ throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
242
253
  }
243
254
  break;
244
255
  }
@@ -246,7 +257,7 @@ export function FSharpList__get_Item_Z524259A4(xs, index) {
246
257
  return loop(0, xs);
247
258
  }
248
259
  export function indexNotFound() {
249
- throw new Error(SR_keyNotFoundAlt);
260
+ throw KeyNotFoundException_$ctor_Z721C83C5(SR_keyNotFoundAlt);
250
261
  }
251
262
  export function empty() {
252
263
  return FSharpList_get_Empty();
@@ -299,7 +310,7 @@ export function tryLast(xs_mut) {
299
310
  export function last(xs) {
300
311
  const matchValue = tryLast(xs);
301
312
  if (matchValue == null) {
302
- throw new Error(SR_inputWasEmpty);
313
+ throw new Exception(SR_inputWasEmpty);
303
314
  }
304
315
  else {
305
316
  return value_1(matchValue);
@@ -407,7 +418,7 @@ export function unfold(generator, state) {
407
418
  const loop = (acc_mut, node_mut) => {
408
419
  loop: while (true) {
409
420
  const acc = acc_mut, node = node_mut;
410
- let t;
421
+ let t = undefined;
411
422
  const matchValue = generator(acc);
412
423
  if (matchValue != null) {
413
424
  acc_mut = value_1(matchValue)[1];
@@ -474,7 +485,7 @@ export function ofSeq(xs) {
474
485
  const enumerator = getEnumerator(xs);
475
486
  try {
476
487
  while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
477
- let xs_3, t;
488
+ let xs_3 = undefined, t = undefined;
478
489
  const x = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
479
490
  node = ((xs_3 = node, (t = (new FSharpList(x, undefined)), (xs_3.tail = t, t))));
480
491
  }
@@ -530,7 +541,7 @@ export function scan(folder, state, xs) {
530
541
  let acc = state;
531
542
  let xs_3 = xs;
532
543
  while (!FSharpList__get_IsEmpty(xs_3)) {
533
- let xs_4, t_2;
544
+ let xs_4 = undefined, t_2 = undefined;
534
545
  acc = folder(acc, FSharpList__get_Head(xs_3));
535
546
  node = ((xs_4 = node, (t_2 = (new FSharpList(acc, undefined)), (xs_4.tail = t_2, t_2))));
536
547
  xs_3 = FSharpList__get_Tail(xs_3);
@@ -553,7 +564,7 @@ export function collect(mapping, xs) {
553
564
  while (!FSharpList__get_IsEmpty(ys)) {
554
565
  let zs = mapping(FSharpList__get_Head(ys));
555
566
  while (!FSharpList__get_IsEmpty(zs)) {
556
- let xs_1, t;
567
+ let xs_1 = undefined, t = undefined;
557
568
  node = ((xs_1 = node, (t = (new FSharpList(FSharpList__get_Head(zs), undefined)), (xs_1.tail = t, t))));
558
569
  zs = FSharpList__get_Tail(zs);
559
570
  }
@@ -604,7 +615,7 @@ export function mapIndexed2(mapping, xs, ys) {
604
615
  const loop = (i_mut, acc_mut, xs_1_mut, ys_1_mut) => {
605
616
  loop: while (true) {
606
617
  const i = i_mut, acc = acc_mut, xs_1 = xs_1_mut, ys_1 = ys_1_mut;
607
- let t;
618
+ let t = undefined;
608
619
  if (FSharpList__get_IsEmpty(xs_1) ? true : FSharpList__get_IsEmpty(ys_1)) {
609
620
  return acc;
610
621
  }
@@ -628,7 +639,7 @@ export function map3(mapping, xs, ys, zs) {
628
639
  const loop = (acc_mut, xs_1_mut, ys_1_mut, zs_1_mut) => {
629
640
  loop: while (true) {
630
641
  const acc = acc_mut, xs_1 = xs_1_mut, ys_1 = ys_1_mut, zs_1 = zs_1_mut;
631
- let t;
642
+ let t = undefined;
632
643
  if ((FSharpList__get_IsEmpty(xs_1) ? true : FSharpList__get_IsEmpty(ys_1)) ? true : FSharpList__get_IsEmpty(zs_1)) {
633
644
  return acc;
634
645
  }
@@ -651,7 +662,7 @@ export function map3(mapping, xs, ys, zs) {
651
662
  export function mapFold(mapping, state, xs) {
652
663
  const root = FSharpList_get_Empty();
653
664
  const patternInput_1 = fold((tupledArg, x) => {
654
- let t;
665
+ let t = undefined;
655
666
  const patternInput = mapping(tupledArg[1], x);
656
667
  return [(t = (new FSharpList(patternInput[0], undefined)), (tupledArg[0].tail = t, t)), patternInput[1]];
657
668
  }, [root, state], xs);
@@ -804,7 +815,7 @@ export function partition(f, xs) {
804
815
  const root2 = FSharpList_get_Empty();
805
816
  const root1 = matchValue;
806
817
  const patternInput_1 = fold((tupledArg, x) => {
807
- let t, t_2;
818
+ let t = undefined, t_2 = undefined;
808
819
  const lacc = tupledArg[0];
809
820
  const racc = tupledArg[1];
810
821
  if (f(x)) {
@@ -844,7 +855,7 @@ export function initialize(n, f) {
844
855
  const root = FSharpList_get_Empty();
845
856
  let node = root;
846
857
  for (let i = 0; i <= (n - 1); i++) {
847
- let xs, t;
858
+ let xs = undefined, t = undefined;
848
859
  node = ((xs = node, (t = (new FSharpList(f(i), undefined)), (xs.tail = t, t))));
849
860
  }
850
861
  const xs_2 = node;
@@ -857,7 +868,7 @@ export function replicate(n, x) {
857
868
  }
858
869
  export function reduce(f, xs) {
859
870
  if (FSharpList__get_IsEmpty(xs)) {
860
- throw new Error(SR_inputWasEmpty);
871
+ throw new Exception(SR_inputWasEmpty);
861
872
  }
862
873
  else {
863
874
  return fold(f, head(xs), tail(xs));
@@ -865,7 +876,7 @@ export function reduce(f, xs) {
865
876
  }
866
877
  export function reduceBack(f, xs) {
867
878
  if (FSharpList__get_IsEmpty(xs)) {
868
- throw new Error(SR_inputWasEmpty);
879
+ throw new Exception(SR_inputWasEmpty);
869
880
  }
870
881
  else {
871
882
  return foldBack(f, tail(xs), head(xs));
@@ -885,7 +896,7 @@ export function exists2(f_mut, xs_mut, ys_mut) {
885
896
  const f = f_mut, xs = xs_mut, ys = ys_mut;
886
897
  const matchValue = FSharpList__get_IsEmpty(xs);
887
898
  const matchValue_1 = FSharpList__get_IsEmpty(ys);
888
- let matchResult;
899
+ let matchResult = undefined;
889
900
  if (matchValue) {
890
901
  if (matchValue_1) {
891
902
  matchResult = 0;
@@ -914,7 +925,7 @@ export function exists2(f_mut, xs_mut, ys_mut) {
914
925
  continue exists2;
915
926
  }
916
927
  default:
917
- throw new Error((SR_differentLengths + "\\nParameter name: ") + "list2");
928
+ throw new Exception((SR_differentLengths + "\\nParameter name: ") + "list2");
918
929
  }
919
930
  break;
920
931
  }
@@ -993,7 +1004,7 @@ export function allPairs(xs, ys) {
993
1004
  let node = root;
994
1005
  iterate((x) => {
995
1006
  iterate((y) => {
996
- let xs_1, t;
1007
+ let xs_1 = undefined, t = undefined;
997
1008
  node = ((xs_1 = node, (t = (new FSharpList([x, y], undefined)), (xs_1.tail = t, t))));
998
1009
  }, ys);
999
1010
  }, xs);
@@ -1009,7 +1020,7 @@ export function skip(count_mut, xs_mut) {
1009
1020
  return xs;
1010
1021
  }
1011
1022
  else if (FSharpList__get_IsEmpty(xs)) {
1012
- throw new Error((SR_notEnoughElements + "\\nParameter name: ") + "list");
1023
+ throw new Exception((SR_notEnoughElements + "\\nParameter name: ") + "list");
1013
1024
  }
1014
1025
  else {
1015
1026
  count_mut = (count - 1);
@@ -1038,17 +1049,17 @@ export function skipWhile(predicate_mut, xs_mut) {
1038
1049
  }
1039
1050
  export function take(count, xs) {
1040
1051
  if (count < 0) {
1041
- throw new Error((SR_inputMustBeNonNegative + "\\nParameter name: ") + "count");
1052
+ throw new Exception((SR_inputMustBeNonNegative + "\\nParameter name: ") + "count");
1042
1053
  }
1043
1054
  const loop = (i_mut, acc_mut, xs_1_mut) => {
1044
1055
  loop: while (true) {
1045
1056
  const i = i_mut, acc = acc_mut, xs_1 = xs_1_mut;
1046
- let t;
1057
+ let t = undefined;
1047
1058
  if (i <= 0) {
1048
1059
  return acc;
1049
1060
  }
1050
1061
  else if (FSharpList__get_IsEmpty(xs_1)) {
1051
- throw new Error((SR_notEnoughElements + "\\nParameter name: ") + "list");
1062
+ throw new Exception((SR_notEnoughElements + "\\nParameter name: ") + "list");
1052
1063
  }
1053
1064
  else {
1054
1065
  i_mut = (i - 1);
@@ -1069,7 +1080,7 @@ export function takeWhile(predicate, xs) {
1069
1080
  const loop = (acc_mut, xs_1_mut) => {
1070
1081
  loop: while (true) {
1071
1082
  const acc = acc_mut, xs_1 = xs_1_mut;
1072
- let t;
1083
+ let t = undefined;
1073
1084
  if (FSharpList__get_IsEmpty(xs_1)) {
1074
1085
  return acc;
1075
1086
  }
@@ -1094,7 +1105,7 @@ export function truncate(count, xs) {
1094
1105
  const loop = (i_mut, acc_mut, xs_1_mut) => {
1095
1106
  loop: while (true) {
1096
1107
  const i = i_mut, acc = acc_mut, xs_1 = xs_1_mut;
1097
- let t;
1108
+ let t = undefined;
1098
1109
  if (i <= 0) {
1099
1110
  return acc;
1100
1111
  }
@@ -1133,22 +1144,22 @@ export function getSlice(startIndex, endIndex, xs) {
1133
1144
  }
1134
1145
  export function splitAt(index, xs) {
1135
1146
  if (index < 0) {
1136
- throw new Error((SR_inputMustBeNonNegative + "\\nParameter name: ") + "index");
1147
+ throw new Exception((SR_inputMustBeNonNegative + "\\nParameter name: ") + "index");
1137
1148
  }
1138
1149
  if (index > FSharpList__get_Length(xs)) {
1139
- throw new Error((SR_notEnoughElements + "\\nParameter name: ") + "index");
1150
+ throw new Exception((SR_notEnoughElements + "\\nParameter name: ") + "index");
1140
1151
  }
1141
1152
  return [take(index, xs), skip(index, xs)];
1142
1153
  }
1143
1154
  export function exactlyOne(xs) {
1144
1155
  if (FSharpList__get_IsEmpty(xs)) {
1145
- throw new Error((SR_inputSequenceEmpty + "\\nParameter name: ") + "list");
1156
+ throw new Exception((SR_inputSequenceEmpty + "\\nParameter name: ") + "list");
1146
1157
  }
1147
1158
  else if (FSharpList__get_IsEmpty(FSharpList__get_Tail(xs))) {
1148
1159
  return FSharpList__get_Head(xs);
1149
1160
  }
1150
1161
  else {
1151
- throw new Error((SR_inputSequenceTooLong + "\\nParameter name: ") + "list");
1162
+ throw new Exception((SR_inputSequenceTooLong + "\\nParameter name: ") + "list");
1152
1163
  }
1153
1164
  }
1154
1165
  export function tryExactlyOne(xs) {
@@ -1188,7 +1199,7 @@ export function insertAt(index, y, xs) {
1188
1199
  }
1189
1200
  }, FSharpList_get_Empty(), xs);
1190
1201
  return reverse(isDone ? result : (((i + 1) === index) ? FSharpList_Cons_305B8EAC(y, result) : (() => {
1191
- throw new Error((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
1202
+ throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
1192
1203
  })()));
1193
1204
  }
1194
1205
  export function insertManyAt(index, ys, xs) {
@@ -1206,7 +1217,7 @@ export function insertManyAt(index, ys, xs) {
1206
1217
  }
1207
1218
  }, FSharpList_get_Empty(), xs);
1208
1219
  return reverse(isDone ? result : (((i + 1) === index) ? append(ys_1, result) : (() => {
1209
- throw new Error((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
1220
+ throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
1210
1221
  })()));
1211
1222
  }
1212
1223
  export function removeAt(index, xs) {
@@ -1223,7 +1234,7 @@ export function removeAt(index, xs) {
1223
1234
  }
1224
1235
  }, xs);
1225
1236
  if (!isDone) {
1226
- throw new Error((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
1237
+ throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
1227
1238
  }
1228
1239
  return ys;
1229
1240
  }
@@ -1251,7 +1262,7 @@ export function removeManyAt(index, count, xs) {
1251
1262
  }, xs);
1252
1263
  const status_1 = (((status === 0) && ((i + 1) === (index + count))) ? 1 : status) | 0;
1253
1264
  if (status_1 < 1) {
1254
- throw new Error((SR_indexOutOfBounds + "\\nParameter name: ") + ((status_1 < 0) ? "index" : "count"));
1265
+ throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + ((status_1 < 0) ? "index" : "count"));
1255
1266
  }
1256
1267
  return ys;
1257
1268
  }
@@ -1267,7 +1278,7 @@ export function updateAt(index, y, xs) {
1267
1278
  }
1268
1279
  }, xs);
1269
1280
  if (!isDone) {
1270
- throw new Error((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
1281
+ throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
1271
1282
  }
1272
1283
  return ys;
1273
1284
  }
package/Long.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { getPrefix, isValid } from "./Int32.js";
2
2
  import { fromString } from "./BigInt.js";
3
+ import { Exception } from "./Util.js";
3
4
  function getMaxValue(unsigned, radix, isNegative) {
4
5
  switch (radix) {
5
6
  case 2: return unsigned ?
@@ -15,7 +16,7 @@ function getMaxValue(unsigned, radix, isNegative) {
15
16
  case 16: return unsigned ?
16
17
  "FFFFFFFFFFFFFFFF" :
17
18
  (isNegative ? "8000000000000000" : "7FFFFFFFFFFFFFFF");
18
- default: throw new Error("Invalid radix.");
19
+ default: throw new Exception("Invalid radix.");
19
20
  }
20
21
  }
21
22
  export function parse(str, style, unsigned, _bitsize, radix) {
@@ -33,7 +34,7 @@ export function parse(str, style, unsigned, _bitsize, radix) {
33
34
  return fromString(str);
34
35
  }
35
36
  }
36
- throw new Error(`The input string ${str} was not in a correct format.`);
37
+ throw new Exception(`The input string ${str} was not in a correct format.`);
37
38
  }
38
39
  export function tryParse(str, style, unsigned, bitsize, defValue) {
39
40
  try {