@fable-org/fable-library-ts 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.ts +1385 -1378
- package/Async.ts +13 -12
- package/AsyncBuilder.ts +10 -11
- package/BigInt.ts +6 -6
- package/BitConverter.ts +3 -3
- package/Boolean.ts +3 -2
- package/CHANGELOG.md +12 -0
- package/Char.ts +38 -35
- package/Choice.ts +326 -301
- package/CollectionUtil.ts +4 -4
- package/Date.ts +67 -62
- package/DateOffset.ts +48 -57
- package/DateOnly.ts +8 -8
- package/Decimal.ts +9 -9
- package/Double.ts +3 -2
- package/Encoding.ts +1 -1
- package/Event.ts +3 -3
- package/FSharp.Collections.ts +53 -34
- package/FSharp.Core.CompilerServices.ts +38 -37
- package/FSharp.Core.ts +186 -185
- package/Global.ts +80 -37
- package/Guid.ts +7 -6
- package/Int32.ts +20 -17
- package/List.ts +1429 -1417
- package/Long.ts +6 -5
- package/MailboxProcessor.ts +8 -7
- package/Map.ts +1550 -1552
- package/MapUtil.ts +5 -5
- package/MutableMap.ts +358 -345
- package/MutableSet.ts +250 -249
- package/Native.ts +19 -11
- package/Numeric.ts +1 -1
- package/Observable.ts +3 -3
- package/Option.ts +10 -4
- package/Random.ts +196 -194
- package/Range.ts +57 -56
- package/Reflection.ts +73 -40
- package/RegExp.ts +5 -3
- package/Result.ts +201 -196
- package/Seq.ts +1517 -1525
- package/Seq2.ts +130 -129
- package/Set.ts +1955 -1955
- package/String.ts +41 -38
- package/System.Collections.Generic.ts +401 -380
- package/System.Text.ts +204 -203
- package/System.ts +366 -0
- package/TimeOnly.ts +10 -10
- package/TimeSpan.ts +11 -11
- package/Timer.ts +2 -2
- package/Types.ts +1 -19
- package/Uri.ts +13 -10
- package/Util.ts +77 -21
- package/package.json +22 -22
- package/tsconfig.json +18 -5
- package/SystemException.ts +0 -7
package/MapUtil.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { equals, IMap, IMapOrWeakMap, ISet } from "./Util.
|
|
2
|
-
import { FSharpRef, Union } from "./Types.
|
|
1
|
+
import { Exception, equals, IMap, IMapOrWeakMap, ISet } from "./Util.ts";
|
|
2
|
+
import { FSharpRef, Union } from "./Types.ts";
|
|
3
3
|
|
|
4
4
|
const CaseRules = {
|
|
5
5
|
None: 0,
|
|
@@ -39,7 +39,7 @@ export function keyValueList(fields: Iterable<any>, caseRule = CaseRules.None) {
|
|
|
39
39
|
const definedCaseRule = caseRule;
|
|
40
40
|
|
|
41
41
|
function fail(kvPair: any) {
|
|
42
|
-
throw new
|
|
42
|
+
throw new Exception("Cannot infer key and value of " + String(kvPair));
|
|
43
43
|
}
|
|
44
44
|
function assign(key: string, caseRule: number, value: any) {
|
|
45
45
|
key = changeCase(key, caseRule);
|
|
@@ -117,7 +117,7 @@ export function tryAddToDict<K, V>(dict: IMapOrWeakMap<K, V>, k: K, v: V) {
|
|
|
117
117
|
|
|
118
118
|
export function addToDict<K, V>(dict: IMapOrWeakMap<K, V>, k: K, v: V) {
|
|
119
119
|
if (dict.has(k)) {
|
|
120
|
-
throw new
|
|
120
|
+
throw new Exception("An item with the same key has already been added. Key: " + k);
|
|
121
121
|
}
|
|
122
122
|
dict.set(k, v);
|
|
123
123
|
}
|
|
@@ -126,7 +126,7 @@ export function getItemFromDict<K, V>(map: IMap<K, V>, key: K) {
|
|
|
126
126
|
if (map.has(key)) {
|
|
127
127
|
return map.get(key) as V;
|
|
128
128
|
} else {
|
|
129
|
-
throw new
|
|
129
|
+
throw new Exception(`The given key '${key}' was not present in the dictionary.`);
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
|