@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.
- package/Array.js +64 -60
- package/Async.js +8 -7
- package/AsyncBuilder.js +6 -6
- package/BigInt.js +3 -3
- package/Boolean.js +2 -1
- package/CHANGELOG.md +12 -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 +19 -19
- package/Global.js +21 -0
- package/Guid.js +5 -4
- package/Int32.js +17 -17
- package/List.js +74 -63
- package/Long.js +3 -2
- package/MailboxProcessor.js +2 -1
- package/Map.js +39 -42
- package/MapUtil.js +4 -4
- package/MutableMap.js +22 -10
- package/MutableSet.js +3 -3
- package/Native.js +9 -3
- package/Option.js +10 -2
- package/Random.js +13 -12
- package/Range.js +2 -2
- package/Reflection.js +16 -16
- package/RegExp.js +4 -3
- package/Seq.js +38 -46
- package/Set.js +41 -42
- package/String.js +44 -35
- package/System.Collections.Generic.js +22 -6
- package/System.Text.js +8 -8
- 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 +32 -9
- package/package.json +23 -23
- 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 -31
- 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 -2
- package/Numeric.d.ts +0 -20
- package/Observable.d.ts +0 -32
- package/Option.d.ts +0 -28
- 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 -165
- 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 -39
- 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 -210
- package/lib/big.d.ts +0 -5
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);
|
package/Map.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { record_type, bool_type, list_type, option_type, class_type } from "./Reflection.js";
|
|
2
2
|
import { some, value as value_1 } from "./Option.js";
|
|
3
|
-
import { structuralHash, compare, toIterator, equals, disposeSafe, getEnumerator, isArrayLike } from "./Util.js";
|
|
3
|
+
import { structuralHash, compare, toIterator, equals, disposeSafe, getEnumerator, isArrayLike, Exception } from "./Util.js";
|
|
4
|
+
import { KeyNotFoundException_$ctor } from "./System.Collections.Generic.js";
|
|
4
5
|
import { singleton, ofArrayWithTail, head, tail, isEmpty as isEmpty_1, fold as fold_1, empty as empty_1, FSharpList, cons } from "./List.js";
|
|
5
6
|
import { map as map_2, item, fill, setItem } from "./Array.js";
|
|
6
7
|
import { Record } from "./Types.js";
|
|
7
8
|
import { tryPick as tryPick_1, pick as pick_1, iterate as iterate_1, compareWith, map as map_1, unfold } from "./Seq.js";
|
|
8
9
|
import { format, join } from "./String.js";
|
|
10
|
+
import { NotSupportedException_$ctor_Z721C83C5 } from "./System.js";
|
|
9
11
|
export class MapTreeLeaf$2 {
|
|
10
12
|
constructor(k, v) {
|
|
11
13
|
this.k = k;
|
|
@@ -75,7 +77,7 @@ export function MapTreeModule_size(x) {
|
|
|
75
77
|
return MapTreeModule_sizeAux(0, x) | 0;
|
|
76
78
|
}
|
|
77
79
|
export function MapTreeModule_mk(l, k, v, r) {
|
|
78
|
-
let mn, mn_1;
|
|
80
|
+
let mn = undefined, mn_1 = undefined;
|
|
79
81
|
let hl;
|
|
80
82
|
const m = l;
|
|
81
83
|
if (m != null) {
|
|
@@ -103,7 +105,7 @@ export function MapTreeModule_mk(l, k, v, r) {
|
|
|
103
105
|
}
|
|
104
106
|
}
|
|
105
107
|
export function MapTreeModule_rebalance(t1, k, v, t2) {
|
|
106
|
-
let mn, mn_1, m_2, m2_2, mn_2, m_3, m2_3, mn_3;
|
|
108
|
+
let mn = undefined, mn_1 = undefined, m_2 = undefined, m2_2 = undefined, mn_2 = undefined, m_3 = undefined, m2_3 = undefined, mn_3 = undefined;
|
|
107
109
|
let t1h;
|
|
108
110
|
const m = t1;
|
|
109
111
|
if (m != null) {
|
|
@@ -133,7 +135,7 @@ export function MapTreeModule_rebalance(t1, k, v, t2) {
|
|
|
133
135
|
return MapTreeModule_mk(MapTreeModule_mk(t1, k, v, MapTreeNode$2__get_Left(t2l)), MapTreeLeaf$2__get_Key(t2l), MapTreeLeaf$2__get_Value(t2l), MapTreeModule_mk(MapTreeNode$2__get_Right(t2l), MapTreeLeaf$2__get_Key(t2$0027), MapTreeLeaf$2__get_Value(t2$0027), MapTreeNode$2__get_Right(t2$0027)));
|
|
134
136
|
}
|
|
135
137
|
else {
|
|
136
|
-
throw new
|
|
138
|
+
throw new Exception("internal error: Map.rebalance");
|
|
137
139
|
}
|
|
138
140
|
}
|
|
139
141
|
else {
|
|
@@ -141,7 +143,7 @@ export function MapTreeModule_rebalance(t1, k, v, t2) {
|
|
|
141
143
|
}
|
|
142
144
|
}
|
|
143
145
|
else {
|
|
144
|
-
throw new
|
|
146
|
+
throw new Exception("internal error: Map.rebalance");
|
|
145
147
|
}
|
|
146
148
|
}
|
|
147
149
|
else if (t1h > (t2h + 2)) {
|
|
@@ -155,7 +157,7 @@ export function MapTreeModule_rebalance(t1, k, v, t2) {
|
|
|
155
157
|
return MapTreeModule_mk(MapTreeModule_mk(MapTreeNode$2__get_Left(t1$0027), MapTreeLeaf$2__get_Key(t1$0027), MapTreeLeaf$2__get_Value(t1$0027), MapTreeNode$2__get_Left(t1r)), MapTreeLeaf$2__get_Key(t1r), MapTreeLeaf$2__get_Value(t1r), MapTreeModule_mk(MapTreeNode$2__get_Right(t1r), k, v, t2));
|
|
156
158
|
}
|
|
157
159
|
else {
|
|
158
|
-
throw new
|
|
160
|
+
throw new Exception("internal error: Map.rebalance");
|
|
159
161
|
}
|
|
160
162
|
}
|
|
161
163
|
else {
|
|
@@ -163,7 +165,7 @@ export function MapTreeModule_rebalance(t1, k, v, t2) {
|
|
|
163
165
|
}
|
|
164
166
|
}
|
|
165
167
|
else {
|
|
166
|
-
throw new
|
|
168
|
+
throw new Exception("internal error: Map.rebalance");
|
|
167
169
|
}
|
|
168
170
|
}
|
|
169
171
|
else {
|
|
@@ -229,7 +231,7 @@ export function MapTreeModule_tryFind(comparer_mut, k_mut, m_mut) {
|
|
|
229
231
|
export function MapTreeModule_find(comparer, k, m) {
|
|
230
232
|
const matchValue = MapTreeModule_tryFind(comparer, k, m);
|
|
231
233
|
if (matchValue == null) {
|
|
232
|
-
throw
|
|
234
|
+
throw KeyNotFoundException_$ctor();
|
|
233
235
|
}
|
|
234
236
|
else {
|
|
235
237
|
return value_1(matchValue);
|
|
@@ -327,7 +329,7 @@ export function MapTreeModule_spliceOutSuccessor(m) {
|
|
|
327
329
|
}
|
|
328
330
|
}
|
|
329
331
|
else {
|
|
330
|
-
throw new
|
|
332
|
+
throw new Exception("internal error: Map.spliceOutSuccessor");
|
|
331
333
|
}
|
|
332
334
|
}
|
|
333
335
|
export function MapTreeModule_remove(comparer, k, m) {
|
|
@@ -846,10 +848,10 @@ export function MapTreeModule_mkIterator(m) {
|
|
|
846
848
|
return new MapTreeModule_MapIterator$2(MapTreeModule_collapseLHS(singleton(m)), false);
|
|
847
849
|
}
|
|
848
850
|
export function MapTreeModule_notStarted() {
|
|
849
|
-
throw new
|
|
851
|
+
throw new Exception("enumeration not started");
|
|
850
852
|
}
|
|
851
853
|
export function MapTreeModule_alreadyFinished() {
|
|
852
|
-
throw new
|
|
854
|
+
throw new Exception("enumeration already finished");
|
|
853
855
|
}
|
|
854
856
|
export function MapTreeModule_current(i) {
|
|
855
857
|
if (i.started) {
|
|
@@ -858,14 +860,14 @@ export function MapTreeModule_current(i) {
|
|
|
858
860
|
if (head(matchValue) != null) {
|
|
859
861
|
const m = value_1(head(matchValue));
|
|
860
862
|
if (m instanceof MapTreeNode$2) {
|
|
861
|
-
throw new
|
|
863
|
+
throw new Exception("Please report error: Map iterator, unexpected stack for current");
|
|
862
864
|
}
|
|
863
865
|
else {
|
|
864
866
|
return [MapTreeLeaf$2__get_Key(m), MapTreeLeaf$2__get_Value(m)];
|
|
865
867
|
}
|
|
866
868
|
}
|
|
867
869
|
else {
|
|
868
|
-
throw new
|
|
870
|
+
throw new Exception("Please report error: Map iterator, unexpected stack for current");
|
|
869
871
|
}
|
|
870
872
|
}
|
|
871
873
|
else {
|
|
@@ -883,7 +885,7 @@ export function MapTreeModule_moveNext(i) {
|
|
|
883
885
|
if (head(matchValue) != null) {
|
|
884
886
|
const m = value_1(head(matchValue));
|
|
885
887
|
if (m instanceof MapTreeNode$2) {
|
|
886
|
-
throw new
|
|
888
|
+
throw new Exception("Please report error: Map iterator, unexpected stack for moveNext");
|
|
887
889
|
}
|
|
888
890
|
else {
|
|
889
891
|
i.stack = MapTreeModule_collapseLHS(tail(matchValue));
|
|
@@ -891,7 +893,7 @@ export function MapTreeModule_moveNext(i) {
|
|
|
891
893
|
}
|
|
892
894
|
}
|
|
893
895
|
else {
|
|
894
|
-
throw new
|
|
896
|
+
throw new Exception("Please report error: Map iterator, unexpected stack for moveNext");
|
|
895
897
|
}
|
|
896
898
|
}
|
|
897
899
|
else {
|
|
@@ -937,7 +939,7 @@ export function MapTreeModule_leftmost(m_mut) {
|
|
|
937
939
|
const m = m_mut;
|
|
938
940
|
if (m != null) {
|
|
939
941
|
const m2 = value_1(m);
|
|
940
|
-
let matchResult, nd_1;
|
|
942
|
+
let matchResult = undefined, nd_1 = undefined;
|
|
941
943
|
if (m2 instanceof MapTreeNode$2) {
|
|
942
944
|
if (MapTreeNode$2__get_Height(m2) > 1) {
|
|
943
945
|
matchResult = 0;
|
|
@@ -964,7 +966,7 @@ export function MapTreeModule_leftmost(m_mut) {
|
|
|
964
966
|
}
|
|
965
967
|
}
|
|
966
968
|
else {
|
|
967
|
-
throw
|
|
969
|
+
throw KeyNotFoundException_$ctor();
|
|
968
970
|
}
|
|
969
971
|
break;
|
|
970
972
|
}
|
|
@@ -974,7 +976,7 @@ export function MapTreeModule_rightmost(m_mut) {
|
|
|
974
976
|
const m = m_mut;
|
|
975
977
|
if (m != null) {
|
|
976
978
|
const m2 = value_1(m);
|
|
977
|
-
let matchResult, nd_1;
|
|
979
|
+
let matchResult = undefined, nd_1 = undefined;
|
|
978
980
|
if (m2 instanceof MapTreeNode$2) {
|
|
979
981
|
if (MapTreeNode$2__get_Height(m2) > 1) {
|
|
980
982
|
matchResult = 0;
|
|
@@ -1001,7 +1003,7 @@ export function MapTreeModule_rightmost(m_mut) {
|
|
|
1001
1003
|
}
|
|
1002
1004
|
}
|
|
1003
1005
|
else {
|
|
1004
|
-
throw
|
|
1006
|
+
throw KeyNotFoundException_$ctor();
|
|
1005
1007
|
}
|
|
1006
1008
|
break;
|
|
1007
1009
|
}
|
|
@@ -1015,13 +1017,13 @@ export class FSharpMap {
|
|
|
1015
1017
|
const this$ = this;
|
|
1016
1018
|
return FSharpMap__ComputeHashCode(this$) | 0;
|
|
1017
1019
|
}
|
|
1018
|
-
Equals(
|
|
1020
|
+
Equals(other) {
|
|
1019
1021
|
const this$ = this;
|
|
1020
|
-
if (
|
|
1021
|
-
const
|
|
1022
|
+
if (other instanceof FSharpMap) {
|
|
1023
|
+
const that = other;
|
|
1022
1024
|
const e1 = getEnumerator(this$);
|
|
1023
1025
|
try {
|
|
1024
|
-
const e2 = getEnumerator(
|
|
1026
|
+
const e2 = getEnumerator(that);
|
|
1025
1027
|
try {
|
|
1026
1028
|
const loop = () => {
|
|
1027
1029
|
const m1 = e1["System.Collections.IEnumerator.MoveNext"]();
|
|
@@ -1080,27 +1082,22 @@ export class FSharpMap {
|
|
|
1080
1082
|
const _ = this;
|
|
1081
1083
|
return MapTreeModule_mkIEnumerator(_.tree);
|
|
1082
1084
|
}
|
|
1083
|
-
CompareTo(
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
}, m, m2) | 0;
|
|
1091
|
-
}
|
|
1092
|
-
else {
|
|
1093
|
-
throw new Error("not comparable\\nParameter name: obj");
|
|
1094
|
-
}
|
|
1085
|
+
CompareTo(other) {
|
|
1086
|
+
let that = undefined;
|
|
1087
|
+
const this$ = this;
|
|
1088
|
+
return ((other instanceof FSharpMap) ? ((that = other, compareWith((kvp1, kvp2) => {
|
|
1089
|
+
const c = this$.comparer.Compare(kvp1[0], kvp2[0]) | 0;
|
|
1090
|
+
return ((c !== 0) ? c : compare(kvp1[1], kvp2[1])) | 0;
|
|
1091
|
+
}, this$, that))) : 1) | 0;
|
|
1095
1092
|
}
|
|
1096
1093
|
"System.Collections.Generic.ICollection`1.Add2B595"(x) {
|
|
1097
|
-
throw
|
|
1094
|
+
throw NotSupportedException_$ctor_Z721C83C5("Map cannot be mutated");
|
|
1098
1095
|
}
|
|
1099
1096
|
"System.Collections.Generic.ICollection`1.Clear"() {
|
|
1100
|
-
throw
|
|
1097
|
+
throw NotSupportedException_$ctor_Z721C83C5("Map cannot be mutated");
|
|
1101
1098
|
}
|
|
1102
1099
|
"System.Collections.Generic.ICollection`1.Remove2B595"(x) {
|
|
1103
|
-
throw
|
|
1100
|
+
throw NotSupportedException_$ctor_Z721C83C5("Map cannot be mutated");
|
|
1104
1101
|
}
|
|
1105
1102
|
"System.Collections.Generic.ICollection`1.Contains2B595"(x) {
|
|
1106
1103
|
const m = this;
|
|
@@ -1126,10 +1123,10 @@ export class FSharpMap {
|
|
|
1126
1123
|
return FSharpMap__get_Count(m) | 0;
|
|
1127
1124
|
}
|
|
1128
1125
|
clear() {
|
|
1129
|
-
throw new
|
|
1126
|
+
throw new Exception("Map cannot be mutated");
|
|
1130
1127
|
}
|
|
1131
1128
|
delete(_arg) {
|
|
1132
|
-
throw new
|
|
1129
|
+
throw new Exception("Map cannot be mutated");
|
|
1133
1130
|
return false;
|
|
1134
1131
|
}
|
|
1135
1132
|
entries() {
|
|
@@ -1150,7 +1147,7 @@ export class FSharpMap {
|
|
|
1150
1147
|
}
|
|
1151
1148
|
set(k, v) {
|
|
1152
1149
|
const m = this;
|
|
1153
|
-
throw new
|
|
1150
|
+
throw new Exception("Map cannot be mutated");
|
|
1154
1151
|
return m;
|
|
1155
1152
|
}
|
|
1156
1153
|
values() {
|
|
@@ -1312,7 +1309,7 @@ export function pick(chooser, table) {
|
|
|
1312
1309
|
return value_1(matchValue);
|
|
1313
1310
|
}
|
|
1314
1311
|
else {
|
|
1315
|
-
throw
|
|
1312
|
+
throw KeyNotFoundException_$ctor();
|
|
1316
1313
|
}
|
|
1317
1314
|
}
|
|
1318
1315
|
export function exists(predicate, table) {
|
package/MapUtil.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { equals } from "./Util.js";
|
|
1
|
+
import { Exception, equals } from "./Util.js";
|
|
2
2
|
import { Union } from "./Types.js";
|
|
3
3
|
const CaseRules = {
|
|
4
4
|
None: 0,
|
|
@@ -34,7 +34,7 @@ export function keyValueList(fields, caseRule = CaseRules.None) {
|
|
|
34
34
|
const obj = {};
|
|
35
35
|
const definedCaseRule = caseRule;
|
|
36
36
|
function fail(kvPair) {
|
|
37
|
-
throw new
|
|
37
|
+
throw new Exception("Cannot infer key and value of " + String(kvPair));
|
|
38
38
|
}
|
|
39
39
|
function assign(key, caseRule, value) {
|
|
40
40
|
key = changeCase(key, caseRule);
|
|
@@ -108,7 +108,7 @@ export function tryAddToDict(dict, k, v) {
|
|
|
108
108
|
}
|
|
109
109
|
export function addToDict(dict, k, v) {
|
|
110
110
|
if (dict.has(k)) {
|
|
111
|
-
throw new
|
|
111
|
+
throw new Exception("An item with the same key has already been added. Key: " + k);
|
|
112
112
|
}
|
|
113
113
|
dict.set(k, v);
|
|
114
114
|
}
|
|
@@ -117,7 +117,7 @@ export function getItemFromDict(map, key) {
|
|
|
117
117
|
return map.get(key);
|
|
118
118
|
}
|
|
119
119
|
else {
|
|
120
|
-
throw new
|
|
120
|
+
throw new Exception(`The given key '${key}' was not present in the dictionary.`);
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
export function getItemFromDictOrCreate(map, key, createValue) {
|
package/MutableMap.js
CHANGED
|
@@ -5,6 +5,8 @@ import { setItem } from "./Array.js";
|
|
|
5
5
|
import { FSharpRef } from "./Types.js";
|
|
6
6
|
import { class_type } from "./Reflection.js";
|
|
7
7
|
import { getItemFromDict, tryGetValue } from "./MapUtil.js";
|
|
8
|
+
import { KeyNotFoundException_$ctor_Z721C83C5 } from "./System.Collections.Generic.js";
|
|
9
|
+
import { ArgumentException_$ctor_Z721C83C5 } from "./System.js";
|
|
8
10
|
import { format } from "./String.js";
|
|
9
11
|
export class Dictionary {
|
|
10
12
|
constructor(pairs, comparer) {
|
|
@@ -53,11 +55,11 @@ export class Dictionary {
|
|
|
53
55
|
"System.Collections.Generic.ICollection`1.Contains2B595"(item) {
|
|
54
56
|
const this$ = this;
|
|
55
57
|
const matchValue = Dictionary__TryFind_2B595(this$, item[0]);
|
|
56
|
-
let matchResult,
|
|
58
|
+
let matchResult = undefined, pair_1 = undefined;
|
|
57
59
|
if (matchValue != null) {
|
|
58
60
|
if (equals(value_1(matchValue)[1], item[1])) {
|
|
59
61
|
matchResult = 0;
|
|
60
|
-
|
|
62
|
+
pair_1 = value_1(matchValue);
|
|
61
63
|
}
|
|
62
64
|
else {
|
|
63
65
|
matchResult = 1;
|
|
@@ -89,14 +91,24 @@ export class Dictionary {
|
|
|
89
91
|
"System.Collections.Generic.ICollection`1.Remove2B595"(item) {
|
|
90
92
|
const this$ = this;
|
|
91
93
|
const matchValue = Dictionary__TryFind_2B595(this$, item[0]);
|
|
94
|
+
let matchResult = undefined, pair_1 = undefined;
|
|
92
95
|
if (matchValue != null) {
|
|
93
96
|
if (equals(value_1(matchValue)[1], item[1])) {
|
|
94
|
-
|
|
97
|
+
matchResult = 0;
|
|
98
|
+
pair_1 = value_1(matchValue);
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
matchResult = 1;
|
|
95
102
|
}
|
|
96
|
-
return true;
|
|
97
103
|
}
|
|
98
104
|
else {
|
|
99
|
-
|
|
105
|
+
matchResult = 1;
|
|
106
|
+
}
|
|
107
|
+
switch (matchResult) {
|
|
108
|
+
case 0:
|
|
109
|
+
return Dictionary__Remove_2B595(this$, item[0]);
|
|
110
|
+
default:
|
|
111
|
+
return false;
|
|
100
112
|
}
|
|
101
113
|
}
|
|
102
114
|
"System.Collections.Generic.IDictionary`2.Add5BDDA1"(key, value) {
|
|
@@ -205,7 +217,7 @@ function Dictionary__TryFindIndex_2B595(this$, k) {
|
|
|
205
217
|
}
|
|
206
218
|
export function Dictionary__TryFind_2B595(this$, k) {
|
|
207
219
|
const matchValue = Dictionary__TryFindIndex_2B595(this$, k);
|
|
208
|
-
let matchResult;
|
|
220
|
+
let matchResult = undefined;
|
|
209
221
|
if (matchValue[0]) {
|
|
210
222
|
if (matchValue[2] > -1) {
|
|
211
223
|
matchResult = 0;
|
|
@@ -250,7 +262,7 @@ export function Dictionary__get_Item_2B595(this$, k) {
|
|
|
250
262
|
return value_1(matchValue)[1];
|
|
251
263
|
}
|
|
252
264
|
else {
|
|
253
|
-
throw
|
|
265
|
+
throw KeyNotFoundException_$ctor_Z721C83C5("The item was not found in collection");
|
|
254
266
|
}
|
|
255
267
|
}
|
|
256
268
|
export function Dictionary__set_Item_5BDDA1(this$, k, v) {
|
|
@@ -271,7 +283,7 @@ export function Dictionary__Add_5BDDA1(this$, k, v) {
|
|
|
271
283
|
const matchValue = Dictionary__TryFindIndex_2B595(this$, k);
|
|
272
284
|
if (matchValue[0]) {
|
|
273
285
|
if (matchValue[2] > -1) {
|
|
274
|
-
throw
|
|
286
|
+
throw ArgumentException_$ctor_Z721C83C5(format("An item with the same key has already been added. Key: {0}", k));
|
|
275
287
|
}
|
|
276
288
|
else {
|
|
277
289
|
const value = void (getItemFromDict(this$.hashMap, matchValue[1]).push([k, v]));
|
|
@@ -283,7 +295,7 @@ export function Dictionary__Add_5BDDA1(this$, k, v) {
|
|
|
283
295
|
}
|
|
284
296
|
export function Dictionary__ContainsKey_2B595(this$, k) {
|
|
285
297
|
const matchValue = Dictionary__TryFindIndex_2B595(this$, k);
|
|
286
|
-
let matchResult;
|
|
298
|
+
let matchResult = undefined;
|
|
287
299
|
if (matchValue[0]) {
|
|
288
300
|
if (matchValue[2] > -1) {
|
|
289
301
|
matchResult = 0;
|
|
@@ -304,7 +316,7 @@ export function Dictionary__ContainsKey_2B595(this$, k) {
|
|
|
304
316
|
}
|
|
305
317
|
export function Dictionary__Remove_2B595(this$, k) {
|
|
306
318
|
const matchValue = Dictionary__TryFindIndex_2B595(this$, k);
|
|
307
|
-
let matchResult;
|
|
319
|
+
let matchResult = undefined;
|
|
308
320
|
if (matchValue[0]) {
|
|
309
321
|
if (matchValue[2] > -1) {
|
|
310
322
|
matchResult = 0;
|
package/MutableSet.js
CHANGED
|
@@ -132,7 +132,7 @@ function HashSet__TryFindIndex_2B595(this$, k) {
|
|
|
132
132
|
}
|
|
133
133
|
function HashSet__TryFind_2B595(this$, k) {
|
|
134
134
|
const matchValue = HashSet__TryFindIndex_2B595(this$, k);
|
|
135
|
-
let matchResult;
|
|
135
|
+
let matchResult = undefined;
|
|
136
136
|
if (matchValue[0]) {
|
|
137
137
|
if (matchValue[2] > -1) {
|
|
138
138
|
matchResult = 0;
|
|
@@ -189,7 +189,7 @@ export function HashSet__Add_2B595(this$, k) {
|
|
|
189
189
|
}
|
|
190
190
|
export function HashSet__Contains_2B595(this$, k) {
|
|
191
191
|
const matchValue = HashSet__TryFindIndex_2B595(this$, k);
|
|
192
|
-
let matchResult;
|
|
192
|
+
let matchResult = undefined;
|
|
193
193
|
if (matchValue[0]) {
|
|
194
194
|
if (matchValue[2] > -1) {
|
|
195
195
|
matchResult = 0;
|
|
@@ -210,7 +210,7 @@ export function HashSet__Contains_2B595(this$, k) {
|
|
|
210
210
|
}
|
|
211
211
|
export function HashSet__Remove_2B595(this$, k) {
|
|
212
212
|
const matchValue = HashSet__TryFindIndex_2B595(this$, k);
|
|
213
|
-
let matchResult;
|
|
213
|
+
let matchResult = undefined;
|
|
214
214
|
if (matchValue[0]) {
|
|
215
215
|
if (matchValue[2] > -1) {
|
|
216
216
|
matchResult = 0;
|
package/Native.js
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
export function Helpers_allocateArrayFromCons(cons, len) {
|
|
2
|
-
if (
|
|
3
|
-
return new
|
|
2
|
+
if (cons == null) {
|
|
3
|
+
return new Array(len);
|
|
4
4
|
}
|
|
5
5
|
else {
|
|
6
|
-
|
|
6
|
+
const cons_1 = cons;
|
|
7
|
+
if ((typeof cons_1) === "function") {
|
|
8
|
+
return new cons_1(len);
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
return new Array(len);
|
|
12
|
+
}
|
|
7
13
|
}
|
|
8
14
|
}
|
package/Option.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { structuralHash, equals, compare } from "./Util.js";
|
|
1
|
+
import { Exception, structuralHash, equals, compare } from "./Util.js";
|
|
2
2
|
// Using a class here for better compatibility with TS files importing Some
|
|
3
3
|
export class Some {
|
|
4
4
|
constructor(value) {
|
|
@@ -31,9 +31,17 @@ export class Some {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
+
export function nonNullValue(x) {
|
|
35
|
+
if (x == null) {
|
|
36
|
+
throw new Exception("Nullable has no value");
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
return x;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
34
42
|
export function value(x) {
|
|
35
43
|
if (x == null) {
|
|
36
|
-
throw new
|
|
44
|
+
throw new Exception("Option has no value");
|
|
37
45
|
}
|
|
38
46
|
else {
|
|
39
47
|
return x instanceof Some ? x.value : x;
|
package/Random.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
+
import { ArgumentNullException_$ctor_Z721C83C5, ArgumentOutOfRangeException_$ctor_Z721C83C5 } from "./System.js";
|
|
2
|
+
import { Operators_IsNull } from "./FSharp.Core.js";
|
|
1
3
|
import { class_type } from "./Reflection.js";
|
|
2
4
|
import { fromFloat64, op_Addition, toInt32_unchecked, toFloat64, compare, fromInt32, toInt64_unchecked } from "./BigInt.js";
|
|
3
|
-
import {
|
|
4
|
-
import { item, fill, setItem } from "./Array.js";
|
|
5
|
+
import { item, setItem } from "./Array.js";
|
|
5
6
|
function Native_random() {
|
|
6
7
|
return Math.random();
|
|
7
8
|
}
|
|
8
|
-
function Native_randomNext(
|
|
9
|
-
if (
|
|
10
|
-
throw
|
|
9
|
+
function Native_randomNext(minValue, maxValue) {
|
|
10
|
+
if (maxValue < minValue) {
|
|
11
|
+
throw ArgumentOutOfRangeException_$ctor_Z721C83C5("minValue must be less than maxValue");
|
|
11
12
|
}
|
|
12
|
-
return Math.floor(Math.random() * (
|
|
13
|
+
return Math.floor(Math.random() * (maxValue - minValue)) + minValue;
|
|
13
14
|
}
|
|
14
15
|
function Native_randomBytes(buffer) {
|
|
15
|
-
if (buffer
|
|
16
|
-
throw
|
|
16
|
+
if (Operators_IsNull(buffer)) {
|
|
17
|
+
throw ArgumentNullException_$ctor_Z721C83C5("buffer");
|
|
17
18
|
}
|
|
18
19
|
for (let i = 0; i < buffer.length; i += 6) {
|
|
19
20
|
// Pick random 48-bit number. Fill buffer in 2 24-bit chunks to avoid bitwise truncation.
|
|
@@ -59,7 +60,7 @@ export class Seeded {
|
|
|
59
60
|
this.MBIG = 2147483647;
|
|
60
61
|
this.inext = 0;
|
|
61
62
|
this.inextp = 0;
|
|
62
|
-
this.seedArray =
|
|
63
|
+
this.seedArray = (new Int32Array(56));
|
|
63
64
|
let ii = 0;
|
|
64
65
|
let mj = 0;
|
|
65
66
|
let mk = 0;
|
|
@@ -94,14 +95,14 @@ export class Seeded {
|
|
|
94
95
|
Next1(maxValue) {
|
|
95
96
|
const this$ = this;
|
|
96
97
|
if (maxValue < 0) {
|
|
97
|
-
throw
|
|
98
|
+
throw ArgumentOutOfRangeException_$ctor_Z721C83C5("maxValue must be positive");
|
|
98
99
|
}
|
|
99
100
|
return ~~(Seeded__Sample(this$) * maxValue) | 0;
|
|
100
101
|
}
|
|
101
102
|
Next2(minValue, maxValue) {
|
|
102
103
|
const this$ = this;
|
|
103
104
|
if (minValue > maxValue) {
|
|
104
|
-
throw
|
|
105
|
+
throw ArgumentOutOfRangeException_$ctor_Z721C83C5("minValue must be less than maxValue");
|
|
105
106
|
}
|
|
106
107
|
const range = toInt64_unchecked(fromInt32(maxValue - minValue));
|
|
107
108
|
return ((compare(range, toInt64_unchecked(fromInt32(2147483647))) <= 0) ? (~~(Seeded__Sample(this$) * toFloat64(range)) + minValue) : ~~toInt32_unchecked(toInt64_unchecked(op_Addition(toInt64_unchecked(fromFloat64(Seeded__GetSampleForLargeRange(this$) * toFloat64(range))), toInt64_unchecked(fromInt32(minValue)))))) | 0;
|
|
@@ -113,7 +114,7 @@ export class Seeded {
|
|
|
113
114
|
NextBytes(buffer) {
|
|
114
115
|
const this$ = this;
|
|
115
116
|
if (Operators_IsNull(buffer)) {
|
|
116
|
-
throw
|
|
117
|
+
throw ArgumentNullException_$ctor_Z721C83C5("buffer");
|
|
117
118
|
}
|
|
118
119
|
for (let i = 0; i <= (buffer.length - 1); i++) {
|
|
119
120
|
setItem(buffer, i, (Seeded__InternalSample(this$) % (~~255 + 1)) & 0xFF);
|
package/Range.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { compare } from "./Util.js";
|
|
1
|
+
import { Exception, compare } from "./Util.js";
|
|
2
2
|
import { unfold, delay } from "./Seq.js";
|
|
3
3
|
import { toUInt64_unchecked, toInt64_unchecked, op_Addition, fromZero } from "./BigInt.js";
|
|
4
4
|
import { op_Addition as op_Addition_1, fromParts } from "./Decimal.js";
|
|
5
5
|
export function makeRangeStepFunction(step, stop, zero, add) {
|
|
6
6
|
const stepComparedWithZero = compare(step, zero) | 0;
|
|
7
7
|
if (stepComparedWithZero === 0) {
|
|
8
|
-
throw new
|
|
8
|
+
throw new Exception("The step of a range cannot be zero");
|
|
9
9
|
}
|
|
10
10
|
const stepGreaterThanZero = stepComparedWithZero > 0;
|
|
11
11
|
return (x) => {
|