@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.
- package/Array.js +56 -52
- package/Async.js +8 -7
- package/AsyncBuilder.js +6 -6
- package/BigInt.js +3 -3
- package/Boolean.js +2 -1
- package/CHANGELOG.md +8 -0
- package/Char.js +64 -31
- package/CollectionUtil.js +3 -3
- package/Date.js +50 -46
- package/DateOffset.js +38 -48
- package/DateOnly.js +6 -6
- package/Decimal.js +4 -4
- package/Double.js +2 -1
- package/FSharp.Collections.js +28 -10
- package/FSharp.Core.js +23 -23
- package/Global.js +21 -0
- package/Guid.js +5 -4
- package/Int32.js +17 -17
- package/List.js +36 -35
- package/Long.js +3 -2
- package/MailboxProcessor.js +2 -1
- package/Map.js +29 -27
- package/MapUtil.js +4 -4
- package/MutableMap.js +22 -10
- package/MutableSet.js +3 -3
- package/Option.js +3 -3
- package/Random.js +12 -11
- package/Range.js +2 -2
- package/Reflection.js +16 -16
- package/RegExp.js +4 -3
- package/Seq.js +31 -29
- package/Set.js +34 -33
- package/String.js +44 -35
- package/System.Collections.Generic.js +20 -4
- package/System.Text.js +3 -3
- package/System.js +283 -0
- package/TimeOnly.js +6 -6
- package/TimeSpan.js +5 -5
- package/Types.js +1 -17
- package/Uri.js +25 -19
- package/Util.js +31 -17
- package/package.json +1 -1
- package/Array.d.ts +0 -123
- package/Async.d.ts +0 -26
- package/AsyncBuilder.d.ts +0 -59
- package/BigInt.d.ts +0 -129
- package/BitConverter.d.ts +0 -27
- package/Boolean.d.ts +0 -3
- package/Char.d.ts +0 -65
- package/Choice.d.ts +0 -121
- package/CollectionUtil.d.ts +0 -7
- package/ConditionalWeakTable.d.ts +0 -9
- package/Date.d.ts +0 -69
- package/DateOffset.d.ts +0 -64
- package/DateOnly.d.ts +0 -18
- package/Decimal.d.ts +0 -63
- package/Double.d.ts +0 -11
- package/Encoding.d.ts +0 -12
- package/Event.d.ts +0 -31
- package/FSharp.Collections.d.ts +0 -7
- package/FSharp.Core.CompilerServices.d.ts +0 -12
- package/FSharp.Core.d.ts +0 -30
- package/Global.d.ts +0 -24
- package/Guid.d.ts +0 -10
- package/Int32.d.ts +0 -28
- package/List.d.ts +0 -143
- package/Long.d.ts +0 -3
- package/MailboxProcessor.d.ts +0 -25
- package/Map.d.ts +0 -178
- package/MapUtil.d.ts +0 -12
- package/MutableMap.d.ts +0 -52
- package/MutableSet.d.ts +0 -39
- package/Native.d.ts +0 -3
- package/Numeric.d.ts +0 -20
- package/Observable.d.ts +0 -32
- package/Option.d.ts +0 -29
- package/Random.d.ts +0 -37
- package/Range.d.ts +0 -12
- package/Reflection.d.ts +0 -119
- package/RegExp.d.ts +0 -10
- package/Result.d.ts +0 -37
- package/Seq.d.ts +0 -164
- package/Seq2.d.ts +0 -18
- package/Set.d.ts +0 -190
- package/String.d.ts +0 -58
- package/System.Collections.Generic.d.ts +0 -79
- package/System.Text.d.ts +0 -40
- package/SystemException.d.ts +0 -5
- package/SystemException.js +0 -5
- package/TimeOnly.d.ts +0 -15
- package/TimeSpan.d.ts +0 -35
- package/Timer.d.ts +0 -19
- package/Types.d.ts +0 -58
- package/Unicode.13.0.0.d.ts +0 -2
- package/Uri.d.ts +0 -31
- package/Util.d.ts +0 -212
- package/lib/big.d.ts +0 -5
package/FSharp.Core.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { disposeSafe, structuralHash,
|
|
1
|
+
import { disposeSafe, defaultOf, Exception, structuralHash, equals } from "./Util.js";
|
|
2
2
|
import { HashIdentity_Structural, ComparisonIdentity_Structural } from "./FSharp.Collections.js";
|
|
3
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
|
-
|
|
9
|
-
return
|
|
8
|
+
Equals(x, y) {
|
|
9
|
+
return equals(x, y);
|
|
10
10
|
},
|
|
11
|
-
|
|
11
|
+
GetHashCode(x_1) {
|
|
12
12
|
return structuralHash(x_1) | 0;
|
|
13
13
|
},
|
|
14
14
|
};
|
|
15
15
|
export const LanguagePrimitives_GenericEqualityERComparer = {
|
|
16
|
-
|
|
17
|
-
return
|
|
16
|
+
Equals(x, y) {
|
|
17
|
+
return equals(x, y);
|
|
18
18
|
},
|
|
19
|
-
|
|
19
|
+
GetHashCode(x_1) {
|
|
20
20
|
return structuralHash(x_1) | 0;
|
|
21
21
|
},
|
|
22
22
|
};
|
|
@@ -33,20 +33,20 @@ export function LanguagePrimitives_FastGenericEqualityComparerFromTable() {
|
|
|
33
33
|
return HashIdentity_Structural();
|
|
34
34
|
}
|
|
35
35
|
export function Operators_Failure(message) {
|
|
36
|
-
return new
|
|
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(
|
|
42
|
-
throw
|
|
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 {
|
|
46
46
|
return action(resource);
|
|
47
47
|
}
|
|
48
48
|
finally {
|
|
49
|
-
if (resource
|
|
49
|
+
if (equals(resource, defaultOf())) {
|
|
50
50
|
}
|
|
51
51
|
else {
|
|
52
52
|
let copyOfStruct = resource;
|
|
@@ -58,7 +58,7 @@ export function Operators_Lock(_lockObj, action) {
|
|
|
58
58
|
return action();
|
|
59
59
|
}
|
|
60
60
|
export function Operators_IsNull(value) {
|
|
61
|
-
if (value
|
|
61
|
+
if (equals(value, defaultOf())) {
|
|
62
62
|
return true;
|
|
63
63
|
}
|
|
64
64
|
else {
|
|
@@ -66,7 +66,7 @@ export function Operators_IsNull(value) {
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
export function Operators_IsNotNull(value) {
|
|
69
|
-
if (value
|
|
69
|
+
if (equals(value, defaultOf())) {
|
|
70
70
|
return false;
|
|
71
71
|
}
|
|
72
72
|
else {
|
|
@@ -77,8 +77,8 @@ export function Operators_IsNullV(value) {
|
|
|
77
77
|
return !(value != null);
|
|
78
78
|
}
|
|
79
79
|
export function Operators_NonNull(value) {
|
|
80
|
-
if (value
|
|
81
|
-
throw
|
|
80
|
+
if (equals(value, defaultOf())) {
|
|
81
|
+
throw NullReferenceException_$ctor();
|
|
82
82
|
}
|
|
83
83
|
else {
|
|
84
84
|
return value;
|
|
@@ -89,11 +89,11 @@ export function Operators_NonNullV(value) {
|
|
|
89
89
|
return nonNullValue(value);
|
|
90
90
|
}
|
|
91
91
|
else {
|
|
92
|
-
throw
|
|
92
|
+
throw NullReferenceException_$ctor();
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
export function Operators_NullMatchPattern(value) {
|
|
96
|
-
if (value
|
|
96
|
+
if (equals(value, defaultOf())) {
|
|
97
97
|
return FSharpChoice$2_Choice1Of2(undefined);
|
|
98
98
|
}
|
|
99
99
|
else {
|
|
@@ -109,8 +109,8 @@ export function Operators_NullValueMatchPattern(value) {
|
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
export function Operators_NonNullQuickPattern(value) {
|
|
112
|
-
if (value
|
|
113
|
-
throw
|
|
112
|
+
if (equals(value, defaultOf())) {
|
|
113
|
+
throw NullReferenceException_$ctor();
|
|
114
114
|
}
|
|
115
115
|
else {
|
|
116
116
|
return value;
|
|
@@ -121,7 +121,7 @@ export function Operators_NonNullQuickValuePattern(value) {
|
|
|
121
121
|
return nonNullValue(value);
|
|
122
122
|
}
|
|
123
123
|
else {
|
|
124
|
-
throw
|
|
124
|
+
throw NullReferenceException_$ctor();
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
export function Operators_WithNull(value) {
|
|
@@ -134,8 +134,8 @@ export function Operators_NullV() {
|
|
|
134
134
|
return null;
|
|
135
135
|
}
|
|
136
136
|
export function Operators_NullArgCheck(argumentName, value) {
|
|
137
|
-
if (value
|
|
138
|
-
throw
|
|
137
|
+
if (equals(value, defaultOf())) {
|
|
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
|
|
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
|
|
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] =
|
|
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
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
// None
|
|
4
|
-
// AllowLeadingWhite
|
|
5
|
-
// AllowTrailingWhite
|
|
6
|
-
// AllowLeadingSign
|
|
7
|
-
// AllowTrailingSign
|
|
8
|
-
// AllowParentheses
|
|
9
|
-
// AllowDecimalPoint
|
|
10
|
-
// AllowThousands
|
|
11
|
-
// AllowExponent
|
|
12
|
-
// AllowCurrencySymbol
|
|
13
|
-
|
|
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
|
-
}
|
|
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
|
|
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
|
|
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
|
|
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) {
|
|
@@ -220,7 +221,7 @@ export function FSharpList__get_Head(xs) {
|
|
|
220
221
|
return xs.head;
|
|
221
222
|
}
|
|
222
223
|
else {
|
|
223
|
-
throw new
|
|
224
|
+
throw new Exception((SR_inputWasEmpty + "\\nParameter name: ") + "list");
|
|
224
225
|
}
|
|
225
226
|
}
|
|
226
227
|
export function FSharpList__get_Tail(xs) {
|
|
@@ -229,7 +230,7 @@ export function FSharpList__get_Tail(xs) {
|
|
|
229
230
|
return value_1(matchValue);
|
|
230
231
|
}
|
|
231
232
|
else {
|
|
232
|
-
throw new
|
|
233
|
+
throw new Exception((SR_inputWasEmpty + "\\nParameter name: ") + "list");
|
|
233
234
|
}
|
|
234
235
|
}
|
|
235
236
|
export function FSharpList__get_Item_Z524259A4(xs, index) {
|
|
@@ -248,7 +249,7 @@ export function FSharpList__get_Item_Z524259A4(xs, index) {
|
|
|
248
249
|
}
|
|
249
250
|
}
|
|
250
251
|
else {
|
|
251
|
-
throw new
|
|
252
|
+
throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
|
|
252
253
|
}
|
|
253
254
|
break;
|
|
254
255
|
}
|
|
@@ -256,7 +257,7 @@ export function FSharpList__get_Item_Z524259A4(xs, index) {
|
|
|
256
257
|
return loop(0, xs);
|
|
257
258
|
}
|
|
258
259
|
export function indexNotFound() {
|
|
259
|
-
throw
|
|
260
|
+
throw KeyNotFoundException_$ctor_Z721C83C5(SR_keyNotFoundAlt);
|
|
260
261
|
}
|
|
261
262
|
export function empty() {
|
|
262
263
|
return FSharpList_get_Empty();
|
|
@@ -309,7 +310,7 @@ export function tryLast(xs_mut) {
|
|
|
309
310
|
export function last(xs) {
|
|
310
311
|
const matchValue = tryLast(xs);
|
|
311
312
|
if (matchValue == null) {
|
|
312
|
-
throw new
|
|
313
|
+
throw new Exception(SR_inputWasEmpty);
|
|
313
314
|
}
|
|
314
315
|
else {
|
|
315
316
|
return value_1(matchValue);
|
|
@@ -417,7 +418,7 @@ export function unfold(generator, state) {
|
|
|
417
418
|
const loop = (acc_mut, node_mut) => {
|
|
418
419
|
loop: while (true) {
|
|
419
420
|
const acc = acc_mut, node = node_mut;
|
|
420
|
-
let t;
|
|
421
|
+
let t = undefined;
|
|
421
422
|
const matchValue = generator(acc);
|
|
422
423
|
if (matchValue != null) {
|
|
423
424
|
acc_mut = value_1(matchValue)[1];
|
|
@@ -484,7 +485,7 @@ export function ofSeq(xs) {
|
|
|
484
485
|
const enumerator = getEnumerator(xs);
|
|
485
486
|
try {
|
|
486
487
|
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
487
|
-
let xs_3, t;
|
|
488
|
+
let xs_3 = undefined, t = undefined;
|
|
488
489
|
const x = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
489
490
|
node = ((xs_3 = node, (t = (new FSharpList(x, undefined)), (xs_3.tail = t, t))));
|
|
490
491
|
}
|
|
@@ -540,7 +541,7 @@ export function scan(folder, state, xs) {
|
|
|
540
541
|
let acc = state;
|
|
541
542
|
let xs_3 = xs;
|
|
542
543
|
while (!FSharpList__get_IsEmpty(xs_3)) {
|
|
543
|
-
let xs_4, t_2;
|
|
544
|
+
let xs_4 = undefined, t_2 = undefined;
|
|
544
545
|
acc = folder(acc, FSharpList__get_Head(xs_3));
|
|
545
546
|
node = ((xs_4 = node, (t_2 = (new FSharpList(acc, undefined)), (xs_4.tail = t_2, t_2))));
|
|
546
547
|
xs_3 = FSharpList__get_Tail(xs_3);
|
|
@@ -563,7 +564,7 @@ export function collect(mapping, xs) {
|
|
|
563
564
|
while (!FSharpList__get_IsEmpty(ys)) {
|
|
564
565
|
let zs = mapping(FSharpList__get_Head(ys));
|
|
565
566
|
while (!FSharpList__get_IsEmpty(zs)) {
|
|
566
|
-
let xs_1, t;
|
|
567
|
+
let xs_1 = undefined, t = undefined;
|
|
567
568
|
node = ((xs_1 = node, (t = (new FSharpList(FSharpList__get_Head(zs), undefined)), (xs_1.tail = t, t))));
|
|
568
569
|
zs = FSharpList__get_Tail(zs);
|
|
569
570
|
}
|
|
@@ -614,7 +615,7 @@ export function mapIndexed2(mapping, xs, ys) {
|
|
|
614
615
|
const loop = (i_mut, acc_mut, xs_1_mut, ys_1_mut) => {
|
|
615
616
|
loop: while (true) {
|
|
616
617
|
const i = i_mut, acc = acc_mut, xs_1 = xs_1_mut, ys_1 = ys_1_mut;
|
|
617
|
-
let t;
|
|
618
|
+
let t = undefined;
|
|
618
619
|
if (FSharpList__get_IsEmpty(xs_1) ? true : FSharpList__get_IsEmpty(ys_1)) {
|
|
619
620
|
return acc;
|
|
620
621
|
}
|
|
@@ -638,7 +639,7 @@ export function map3(mapping, xs, ys, zs) {
|
|
|
638
639
|
const loop = (acc_mut, xs_1_mut, ys_1_mut, zs_1_mut) => {
|
|
639
640
|
loop: while (true) {
|
|
640
641
|
const acc = acc_mut, xs_1 = xs_1_mut, ys_1 = ys_1_mut, zs_1 = zs_1_mut;
|
|
641
|
-
let t;
|
|
642
|
+
let t = undefined;
|
|
642
643
|
if ((FSharpList__get_IsEmpty(xs_1) ? true : FSharpList__get_IsEmpty(ys_1)) ? true : FSharpList__get_IsEmpty(zs_1)) {
|
|
643
644
|
return acc;
|
|
644
645
|
}
|
|
@@ -661,7 +662,7 @@ export function map3(mapping, xs, ys, zs) {
|
|
|
661
662
|
export function mapFold(mapping, state, xs) {
|
|
662
663
|
const root = FSharpList_get_Empty();
|
|
663
664
|
const patternInput_1 = fold((tupledArg, x) => {
|
|
664
|
-
let t;
|
|
665
|
+
let t = undefined;
|
|
665
666
|
const patternInput = mapping(tupledArg[1], x);
|
|
666
667
|
return [(t = (new FSharpList(patternInput[0], undefined)), (tupledArg[0].tail = t, t)), patternInput[1]];
|
|
667
668
|
}, [root, state], xs);
|
|
@@ -814,7 +815,7 @@ export function partition(f, xs) {
|
|
|
814
815
|
const root2 = FSharpList_get_Empty();
|
|
815
816
|
const root1 = matchValue;
|
|
816
817
|
const patternInput_1 = fold((tupledArg, x) => {
|
|
817
|
-
let t, t_2;
|
|
818
|
+
let t = undefined, t_2 = undefined;
|
|
818
819
|
const lacc = tupledArg[0];
|
|
819
820
|
const racc = tupledArg[1];
|
|
820
821
|
if (f(x)) {
|
|
@@ -854,7 +855,7 @@ export function initialize(n, f) {
|
|
|
854
855
|
const root = FSharpList_get_Empty();
|
|
855
856
|
let node = root;
|
|
856
857
|
for (let i = 0; i <= (n - 1); i++) {
|
|
857
|
-
let xs, t;
|
|
858
|
+
let xs = undefined, t = undefined;
|
|
858
859
|
node = ((xs = node, (t = (new FSharpList(f(i), undefined)), (xs.tail = t, t))));
|
|
859
860
|
}
|
|
860
861
|
const xs_2 = node;
|
|
@@ -867,7 +868,7 @@ export function replicate(n, x) {
|
|
|
867
868
|
}
|
|
868
869
|
export function reduce(f, xs) {
|
|
869
870
|
if (FSharpList__get_IsEmpty(xs)) {
|
|
870
|
-
throw new
|
|
871
|
+
throw new Exception(SR_inputWasEmpty);
|
|
871
872
|
}
|
|
872
873
|
else {
|
|
873
874
|
return fold(f, head(xs), tail(xs));
|
|
@@ -875,7 +876,7 @@ export function reduce(f, xs) {
|
|
|
875
876
|
}
|
|
876
877
|
export function reduceBack(f, xs) {
|
|
877
878
|
if (FSharpList__get_IsEmpty(xs)) {
|
|
878
|
-
throw new
|
|
879
|
+
throw new Exception(SR_inputWasEmpty);
|
|
879
880
|
}
|
|
880
881
|
else {
|
|
881
882
|
return foldBack(f, tail(xs), head(xs));
|
|
@@ -895,7 +896,7 @@ export function exists2(f_mut, xs_mut, ys_mut) {
|
|
|
895
896
|
const f = f_mut, xs = xs_mut, ys = ys_mut;
|
|
896
897
|
const matchValue = FSharpList__get_IsEmpty(xs);
|
|
897
898
|
const matchValue_1 = FSharpList__get_IsEmpty(ys);
|
|
898
|
-
let matchResult;
|
|
899
|
+
let matchResult = undefined;
|
|
899
900
|
if (matchValue) {
|
|
900
901
|
if (matchValue_1) {
|
|
901
902
|
matchResult = 0;
|
|
@@ -924,7 +925,7 @@ export function exists2(f_mut, xs_mut, ys_mut) {
|
|
|
924
925
|
continue exists2;
|
|
925
926
|
}
|
|
926
927
|
default:
|
|
927
|
-
throw new
|
|
928
|
+
throw new Exception((SR_differentLengths + "\\nParameter name: ") + "list2");
|
|
928
929
|
}
|
|
929
930
|
break;
|
|
930
931
|
}
|
|
@@ -1003,7 +1004,7 @@ export function allPairs(xs, ys) {
|
|
|
1003
1004
|
let node = root;
|
|
1004
1005
|
iterate((x) => {
|
|
1005
1006
|
iterate((y) => {
|
|
1006
|
-
let xs_1, t;
|
|
1007
|
+
let xs_1 = undefined, t = undefined;
|
|
1007
1008
|
node = ((xs_1 = node, (t = (new FSharpList([x, y], undefined)), (xs_1.tail = t, t))));
|
|
1008
1009
|
}, ys);
|
|
1009
1010
|
}, xs);
|
|
@@ -1019,7 +1020,7 @@ export function skip(count_mut, xs_mut) {
|
|
|
1019
1020
|
return xs;
|
|
1020
1021
|
}
|
|
1021
1022
|
else if (FSharpList__get_IsEmpty(xs)) {
|
|
1022
|
-
throw new
|
|
1023
|
+
throw new Exception((SR_notEnoughElements + "\\nParameter name: ") + "list");
|
|
1023
1024
|
}
|
|
1024
1025
|
else {
|
|
1025
1026
|
count_mut = (count - 1);
|
|
@@ -1048,17 +1049,17 @@ export function skipWhile(predicate_mut, xs_mut) {
|
|
|
1048
1049
|
}
|
|
1049
1050
|
export function take(count, xs) {
|
|
1050
1051
|
if (count < 0) {
|
|
1051
|
-
throw new
|
|
1052
|
+
throw new Exception((SR_inputMustBeNonNegative + "\\nParameter name: ") + "count");
|
|
1052
1053
|
}
|
|
1053
1054
|
const loop = (i_mut, acc_mut, xs_1_mut) => {
|
|
1054
1055
|
loop: while (true) {
|
|
1055
1056
|
const i = i_mut, acc = acc_mut, xs_1 = xs_1_mut;
|
|
1056
|
-
let t;
|
|
1057
|
+
let t = undefined;
|
|
1057
1058
|
if (i <= 0) {
|
|
1058
1059
|
return acc;
|
|
1059
1060
|
}
|
|
1060
1061
|
else if (FSharpList__get_IsEmpty(xs_1)) {
|
|
1061
|
-
throw new
|
|
1062
|
+
throw new Exception((SR_notEnoughElements + "\\nParameter name: ") + "list");
|
|
1062
1063
|
}
|
|
1063
1064
|
else {
|
|
1064
1065
|
i_mut = (i - 1);
|
|
@@ -1079,7 +1080,7 @@ export function takeWhile(predicate, xs) {
|
|
|
1079
1080
|
const loop = (acc_mut, xs_1_mut) => {
|
|
1080
1081
|
loop: while (true) {
|
|
1081
1082
|
const acc = acc_mut, xs_1 = xs_1_mut;
|
|
1082
|
-
let t;
|
|
1083
|
+
let t = undefined;
|
|
1083
1084
|
if (FSharpList__get_IsEmpty(xs_1)) {
|
|
1084
1085
|
return acc;
|
|
1085
1086
|
}
|
|
@@ -1104,7 +1105,7 @@ export function truncate(count, xs) {
|
|
|
1104
1105
|
const loop = (i_mut, acc_mut, xs_1_mut) => {
|
|
1105
1106
|
loop: while (true) {
|
|
1106
1107
|
const i = i_mut, acc = acc_mut, xs_1 = xs_1_mut;
|
|
1107
|
-
let t;
|
|
1108
|
+
let t = undefined;
|
|
1108
1109
|
if (i <= 0) {
|
|
1109
1110
|
return acc;
|
|
1110
1111
|
}
|
|
@@ -1143,22 +1144,22 @@ export function getSlice(startIndex, endIndex, xs) {
|
|
|
1143
1144
|
}
|
|
1144
1145
|
export function splitAt(index, xs) {
|
|
1145
1146
|
if (index < 0) {
|
|
1146
|
-
throw new
|
|
1147
|
+
throw new Exception((SR_inputMustBeNonNegative + "\\nParameter name: ") + "index");
|
|
1147
1148
|
}
|
|
1148
1149
|
if (index > FSharpList__get_Length(xs)) {
|
|
1149
|
-
throw new
|
|
1150
|
+
throw new Exception((SR_notEnoughElements + "\\nParameter name: ") + "index");
|
|
1150
1151
|
}
|
|
1151
1152
|
return [take(index, xs), skip(index, xs)];
|
|
1152
1153
|
}
|
|
1153
1154
|
export function exactlyOne(xs) {
|
|
1154
1155
|
if (FSharpList__get_IsEmpty(xs)) {
|
|
1155
|
-
throw new
|
|
1156
|
+
throw new Exception((SR_inputSequenceEmpty + "\\nParameter name: ") + "list");
|
|
1156
1157
|
}
|
|
1157
1158
|
else if (FSharpList__get_IsEmpty(FSharpList__get_Tail(xs))) {
|
|
1158
1159
|
return FSharpList__get_Head(xs);
|
|
1159
1160
|
}
|
|
1160
1161
|
else {
|
|
1161
|
-
throw new
|
|
1162
|
+
throw new Exception((SR_inputSequenceTooLong + "\\nParameter name: ") + "list");
|
|
1162
1163
|
}
|
|
1163
1164
|
}
|
|
1164
1165
|
export function tryExactlyOne(xs) {
|
|
@@ -1198,7 +1199,7 @@ export function insertAt(index, y, xs) {
|
|
|
1198
1199
|
}
|
|
1199
1200
|
}, FSharpList_get_Empty(), xs);
|
|
1200
1201
|
return reverse(isDone ? result : (((i + 1) === index) ? FSharpList_Cons_305B8EAC(y, result) : (() => {
|
|
1201
|
-
throw new
|
|
1202
|
+
throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
|
|
1202
1203
|
})()));
|
|
1203
1204
|
}
|
|
1204
1205
|
export function insertManyAt(index, ys, xs) {
|
|
@@ -1216,7 +1217,7 @@ export function insertManyAt(index, ys, xs) {
|
|
|
1216
1217
|
}
|
|
1217
1218
|
}, FSharpList_get_Empty(), xs);
|
|
1218
1219
|
return reverse(isDone ? result : (((i + 1) === index) ? append(ys_1, result) : (() => {
|
|
1219
|
-
throw new
|
|
1220
|
+
throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
|
|
1220
1221
|
})()));
|
|
1221
1222
|
}
|
|
1222
1223
|
export function removeAt(index, xs) {
|
|
@@ -1233,7 +1234,7 @@ export function removeAt(index, xs) {
|
|
|
1233
1234
|
}
|
|
1234
1235
|
}, xs);
|
|
1235
1236
|
if (!isDone) {
|
|
1236
|
-
throw new
|
|
1237
|
+
throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
|
|
1237
1238
|
}
|
|
1238
1239
|
return ys;
|
|
1239
1240
|
}
|
|
@@ -1261,7 +1262,7 @@ export function removeManyAt(index, count, xs) {
|
|
|
1261
1262
|
}, xs);
|
|
1262
1263
|
const status_1 = (((status === 0) && ((i + 1) === (index + count))) ? 1 : status) | 0;
|
|
1263
1264
|
if (status_1 < 1) {
|
|
1264
|
-
throw new
|
|
1265
|
+
throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + ((status_1 < 0) ? "index" : "count"));
|
|
1265
1266
|
}
|
|
1266
1267
|
return ys;
|
|
1267
1268
|
}
|
|
@@ -1277,7 +1278,7 @@ export function updateAt(index, y, xs) {
|
|
|
1277
1278
|
}
|
|
1278
1279
|
}, xs);
|
|
1279
1280
|
if (!isDone) {
|
|
1280
|
-
throw new
|
|
1281
|
+
throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
|
|
1281
1282
|
}
|
|
1282
1283
|
return ys;
|
|
1283
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
|
|
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
|
|
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 {
|
package/MailboxProcessor.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { defaultCancellationToken } from "./Async.js";
|
|
2
2
|
import { fromContinuations } from "./Async.js";
|
|
3
3
|
import { startImmediate } from "./Async.js";
|
|
4
|
+
import { Exception } from "./Util.js";
|
|
4
5
|
class QueueCell {
|
|
5
6
|
constructor(message) {
|
|
6
7
|
this.value = message;
|
|
@@ -54,7 +55,7 @@ export function startInstance($this) {
|
|
|
54
55
|
export function receive($this) {
|
|
55
56
|
return fromContinuations((conts) => {
|
|
56
57
|
if ($this.continuation) {
|
|
57
|
-
throw new
|
|
58
|
+
throw new Exception("Receive can only be called once!");
|
|
58
59
|
}
|
|
59
60
|
$this.continuation = conts[0];
|
|
60
61
|
__processEvents($this);
|