@fable-org/fable-library-ts 1.10.0 → 1.11.0
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 +10 -11
- package/Async.ts +13 -14
- package/CHANGELOG.md +4 -17
- package/Choice.ts +4 -5
- package/Date.ts +2 -4
- package/DateOffset.ts +0 -4
- package/FSharp.Core.ts +1 -99
- package/Random.ts +1 -2
- package/Result.ts +38 -38
- package/Seq.ts +2 -2
- package/System.Text.ts +1 -7
- package/TimeSpan.ts +8 -12
- package/package.json +1 -1
package/Array.ts
CHANGED
|
@@ -5,7 +5,6 @@ import { value as value_2, map as map_1, defaultArg, Option, some } from "./Opti
|
|
|
5
5
|
import { min as min_1, max as max_1 } from "./Double.js";
|
|
6
6
|
import { IComparer, equals as equals_1, IDisposable, disposeSafe, IEnumerator, getEnumerator, copyToArray, IEqualityComparer, defaultOf } from "./Util.js";
|
|
7
7
|
import { SR_indexOutOfBounds } from "./Global.js";
|
|
8
|
-
import { Operators_IsNull } from "./FSharp.Core.js";
|
|
9
8
|
import { FSharpRef } from "./Types.js";
|
|
10
9
|
|
|
11
10
|
function indexNotFound<$a>(): $a {
|
|
@@ -866,15 +865,15 @@ export function splitAt<T>(index: int32, array: T[]): [T[], T[]] {
|
|
|
866
865
|
}
|
|
867
866
|
|
|
868
867
|
export function compareWith<T>(comparer: ((arg0: T, arg1: T) => int32), source1: T[], source2: T[]): int32 {
|
|
869
|
-
if (
|
|
870
|
-
if (
|
|
868
|
+
if (source1 == null) {
|
|
869
|
+
if (source2 == null) {
|
|
871
870
|
return 0;
|
|
872
871
|
}
|
|
873
872
|
else {
|
|
874
873
|
return -1;
|
|
875
874
|
}
|
|
876
875
|
}
|
|
877
|
-
else if (
|
|
876
|
+
else if (source2 == null) {
|
|
878
877
|
return 1;
|
|
879
878
|
}
|
|
880
879
|
else {
|
|
@@ -903,15 +902,15 @@ export function compareWith<T>(comparer: ((arg0: T, arg1: T) => int32), source1:
|
|
|
903
902
|
}
|
|
904
903
|
|
|
905
904
|
export function compareTo<T>(comparer: ((arg0: T, arg1: T) => int32), source1: T[], source2: T[]): int32 {
|
|
906
|
-
if (
|
|
907
|
-
if (
|
|
905
|
+
if (source1 == null) {
|
|
906
|
+
if (source2 == null) {
|
|
908
907
|
return 0;
|
|
909
908
|
}
|
|
910
909
|
else {
|
|
911
910
|
return -1;
|
|
912
911
|
}
|
|
913
912
|
}
|
|
914
|
-
else if (
|
|
913
|
+
else if (source2 == null) {
|
|
915
914
|
return 1;
|
|
916
915
|
}
|
|
917
916
|
else {
|
|
@@ -936,15 +935,15 @@ export function compareTo<T>(comparer: ((arg0: T, arg1: T) => int32), source1: T
|
|
|
936
935
|
}
|
|
937
936
|
|
|
938
937
|
export function equalsWith<T>(equals: ((arg0: T, arg1: T) => boolean), array1: T[], array2: T[]): boolean {
|
|
939
|
-
if (
|
|
940
|
-
if (
|
|
938
|
+
if (array1 == null) {
|
|
939
|
+
if (array2 == null) {
|
|
941
940
|
return true;
|
|
942
941
|
}
|
|
943
942
|
else {
|
|
944
943
|
return false;
|
|
945
944
|
}
|
|
946
945
|
}
|
|
947
|
-
else if (
|
|
946
|
+
else if (array2 == null) {
|
|
948
947
|
return false;
|
|
949
948
|
}
|
|
950
949
|
else {
|
|
@@ -1358,7 +1357,7 @@ export function resize<T>(xs: FSharpRef<T[]>, newSize: int32, zero?: Option<T>,
|
|
|
1358
1357
|
throw new Error("The input must be non-negative.\\nParameter name: newSize");
|
|
1359
1358
|
}
|
|
1360
1359
|
const zero_1: T = defaultArg<T>(zero, defaultOf());
|
|
1361
|
-
if (
|
|
1360
|
+
if (xs.contents == null) {
|
|
1362
1361
|
xs.contents = ((array = Helpers_allocateArrayFromCons<T>(cons, newSize), array.fill(zero_1, 0, (0 + newSize))));
|
|
1363
1362
|
}
|
|
1364
1363
|
else {
|
package/Async.ts
CHANGED
|
@@ -159,12 +159,14 @@ export function sleep(millisecondsDueTime: number) {
|
|
|
159
159
|
});
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
export function runSynchronously(): never {
|
|
163
|
-
throw new Error("Asynchronous code cannot be run synchronously in JS");
|
|
164
|
-
}
|
|
165
|
-
|
|
166
162
|
export function start<T>(computation: Async<T>, cancellationToken?: CancellationToken) {
|
|
167
|
-
return startWithContinuations(
|
|
163
|
+
return startWithContinuations(
|
|
164
|
+
computation,
|
|
165
|
+
emptyContinuation,
|
|
166
|
+
function (err) { throw err },
|
|
167
|
+
emptyContinuation,
|
|
168
|
+
cancellationToken
|
|
169
|
+
);
|
|
168
170
|
}
|
|
169
171
|
|
|
170
172
|
export function startImmediate<T>(computation: Async<T>, cancellationToken?: CancellationToken) {
|
|
@@ -173,19 +175,16 @@ export function startImmediate<T>(computation: Async<T>, cancellationToken?: Can
|
|
|
173
175
|
|
|
174
176
|
export function startWithContinuations<T>(
|
|
175
177
|
computation: Async<T>,
|
|
176
|
-
continuation
|
|
177
|
-
exceptionContinuation
|
|
178
|
-
cancellationContinuation
|
|
178
|
+
continuation: Continuation<T>,
|
|
179
|
+
exceptionContinuation: Continuation<any>,
|
|
180
|
+
cancellationContinuation: Continuation<any>,
|
|
179
181
|
cancelToken?: CancellationToken) {
|
|
180
|
-
|
|
181
|
-
cancelToken = continuation as CancellationToken;
|
|
182
|
-
continuation = undefined;
|
|
183
|
-
}
|
|
182
|
+
|
|
184
183
|
const trampoline = new Trampoline();
|
|
185
184
|
computation({
|
|
186
185
|
onSuccess: continuation ? continuation as Continuation<T> : emptyContinuation,
|
|
187
|
-
onError: exceptionContinuation
|
|
188
|
-
onCancel: cancellationContinuation
|
|
186
|
+
onError: exceptionContinuation,
|
|
187
|
+
onCancel: cancellationContinuation,
|
|
189
188
|
cancelToken: cancelToken ? cancelToken : defaultCancellationToken,
|
|
190
189
|
trampoline,
|
|
191
190
|
});
|
package/CHANGELOG.md
CHANGED
|
@@ -7,26 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## Unreleased
|
|
9
9
|
|
|
10
|
-
## 1.
|
|
11
|
-
|
|
12
|
-
### Added
|
|
13
|
-
|
|
14
|
-
* [JS/TS] Add `StringBuiler.Append(c: char, repeatCount: int)` overload (by @roboz0r)
|
|
15
|
-
|
|
16
|
-
## 1.9.0 - 2025-01-09
|
|
17
|
-
|
|
18
|
-
### Added
|
|
19
|
-
|
|
20
|
-
* [JS/TS] Add new `TimSpane` overload support coming from .NET 9 (by @MangelMaxime)
|
|
10
|
+
## 1.11.0- 2025-04-26
|
|
21
11
|
|
|
22
12
|
### Fixed
|
|
23
13
|
|
|
24
|
-
* [JS/TS]
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
* [JS/TS] Fix `h` in `DateTime.ToString` (@MangelMaxime)
|
|
29
|
-
* [JS/TS] Fix `hh` in `DateTime.ToString` (@MangelMaxime)
|
|
14
|
+
* [JS/TS] Propagate non-captured exception when running `Async.Start` or `Async.StartImmediate` (by @MangelMaxime)
|
|
15
|
+
* [JS/TS] Remove `Async.RunSynchronously` (by @MangelMaxime)
|
|
16
|
+
* [JS/TS] Change signature of `startWithContinuations` to always require all its arguments (by @MangelMaxime)
|
|
30
17
|
|
|
31
18
|
## 1.7.0 - 2024-11-19
|
|
32
19
|
|
package/Choice.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Union } from "./Types.js";
|
|
2
2
|
import { union_type, TypeInfo } from "./Reflection.js";
|
|
3
|
-
import { int32 } from "./Int32.js";
|
|
4
3
|
import { Option, some } from "./Option.js";
|
|
5
4
|
|
|
6
5
|
export type FSharpChoice$2_$union<T1, T2> =
|
|
@@ -282,8 +281,8 @@ export function Choice_makeChoice2Of2<T2, a>(x: T2): FSharpChoice$2_$union<a, T2
|
|
|
282
281
|
}
|
|
283
282
|
|
|
284
283
|
export function Choice_tryValueIfChoice1Of2<T1, T2>(x: FSharpChoice$2_$union<T1, T2>): Option<T1> {
|
|
285
|
-
if (
|
|
286
|
-
return some(x.fields[0]
|
|
284
|
+
if (x.tag === /* Choice1Of2 */ 0) {
|
|
285
|
+
return some(x.fields[0]);
|
|
287
286
|
}
|
|
288
287
|
else {
|
|
289
288
|
return undefined;
|
|
@@ -291,8 +290,8 @@ export function Choice_tryValueIfChoice1Of2<T1, T2>(x: FSharpChoice$2_$union<T1,
|
|
|
291
290
|
}
|
|
292
291
|
|
|
293
292
|
export function Choice_tryValueIfChoice2Of2<T1, T2>(x: FSharpChoice$2_$union<T1, T2>): Option<T2> {
|
|
294
|
-
if (
|
|
295
|
-
return some(x.fields[0]
|
|
293
|
+
if (x.tag === /* Choice2Of2 */ 1) {
|
|
294
|
+
return some(x.fields[0]);
|
|
296
295
|
}
|
|
297
296
|
else {
|
|
298
297
|
return undefined;
|
package/Date.ts
CHANGED
|
@@ -166,12 +166,10 @@ function dateToStringWithCustomFormat(date: Date, format: string, utc: boolean)
|
|
|
166
166
|
cursorPos += tokenLength;
|
|
167
167
|
switch (tokenLength) {
|
|
168
168
|
case 1:
|
|
169
|
-
|
|
170
|
-
result += h1Value ? h1Value : 12;
|
|
169
|
+
result += hour(localizedDate) % 12
|
|
171
170
|
break;
|
|
172
171
|
case 2:
|
|
173
|
-
|
|
174
|
-
result += padWithZeros(h2Value ? h2Value : 12, 2);
|
|
172
|
+
result += padWithZeros(hour(localizedDate) % 12, 2);
|
|
175
173
|
break;
|
|
176
174
|
default:
|
|
177
175
|
break;
|
package/DateOffset.ts
CHANGED
|
@@ -166,10 +166,6 @@ export function toUniversalTime(date: IDateTimeOffset): Date {
|
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
export function toLocalTime(date: IDateTimeOffset): Date {
|
|
169
|
-
return DateTime(date.getTime() + offset(now()), DateKind.Local);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
export function localDateTime(date: IDateTimeOffset) : Date {
|
|
173
169
|
return DateTime(date.getTime(), DateKind.Local);
|
|
174
170
|
}
|
|
175
171
|
|
package/FSharp.Core.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { IDisposable, disposeSafe, defaultOf, IEqualityComparer, IComparer, structuralHash, equals } from "./Util.js";
|
|
2
2
|
import { int32 } from "./Int32.js";
|
|
3
3
|
import { HashIdentity_Structural, ComparisonIdentity_Structural } from "./FSharp.Collections.js";
|
|
4
|
-
import {
|
|
5
|
-
import { FSharpChoice$2_$union, FSharpChoice$2_Choice2Of2, FSharpChoice$2_Choice1Of2 } from "./Choice.js";
|
|
4
|
+
import { Option } from "./Option.js";
|
|
6
5
|
import { StringBuilder, StringBuilder__Append_Z721C83C5 } from "./System.Text.js";
|
|
7
6
|
|
|
8
7
|
export const LanguagePrimitives_GenericEqualityComparer: any = {
|
|
@@ -69,103 +68,6 @@ export function Operators_Lock<$a, $b>(_lockObj: $a, action: (() => $b)): $b {
|
|
|
69
68
|
return action();
|
|
70
69
|
}
|
|
71
70
|
|
|
72
|
-
export function Operators_IsNull<T>(value: T): boolean {
|
|
73
|
-
if (equals(value, defaultOf())) {
|
|
74
|
-
return true;
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
return false;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export function Operators_IsNotNull<T>(value: T): boolean {
|
|
82
|
-
if (equals(value, defaultOf())) {
|
|
83
|
-
return false;
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
return true;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export function Operators_IsNullV<T extends any>(value: Nullable<T>): boolean {
|
|
91
|
-
return !(value != null);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export function Operators_NonNull<T>(value: T): T {
|
|
95
|
-
if (equals(value, defaultOf())) {
|
|
96
|
-
throw new Error();
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
return value;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
export function Operators_NonNullV<T extends any>(value: Nullable<T>): T {
|
|
104
|
-
if (value != null) {
|
|
105
|
-
return value_1(value);
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
throw new Error();
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export function Operators_NullMatchPattern<T>(value: T): FSharpChoice$2_$union<void, T> {
|
|
113
|
-
if (equals(value, defaultOf())) {
|
|
114
|
-
return FSharpChoice$2_Choice1Of2<void, T>(undefined);
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
return FSharpChoice$2_Choice2Of2<void, T>(value);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export function Operators_NullValueMatchPattern<T extends any>(value: Nullable<T>): FSharpChoice$2_$union<void, T> {
|
|
122
|
-
if (value != null) {
|
|
123
|
-
return FSharpChoice$2_Choice2Of2<void, T>(value_1(value));
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
return FSharpChoice$2_Choice1Of2<void, T>(undefined);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export function Operators_NonNullQuickPattern<T>(value: T): T {
|
|
131
|
-
if (equals(value, defaultOf())) {
|
|
132
|
-
throw new Error();
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
return value;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
export function Operators_NonNullQuickValuePattern<T extends any>(value: Nullable<T>): T {
|
|
140
|
-
if (value != null) {
|
|
141
|
-
return value_1(value);
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
throw new Error();
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
export function Operators_WithNull<T>(value: T): T {
|
|
149
|
-
return value;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
export function Operators_WithNullV<T extends any>(value: T): T {
|
|
153
|
-
return value;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
export function Operators_NullV<T extends any>(): Nullable<T> {
|
|
157
|
-
return defaultOf();
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
export function Operators_NullArgCheck<T>(argumentName: string, value: T): T {
|
|
161
|
-
if (equals(value, defaultOf())) {
|
|
162
|
-
throw new Error(argumentName);
|
|
163
|
-
}
|
|
164
|
-
else {
|
|
165
|
-
return value;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
71
|
export function ExtraTopLevelOperators_LazyPattern<$a>(input: any): $a {
|
|
170
72
|
return input.Value;
|
|
171
73
|
}
|
package/Random.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { uint8, int32, float64 } from "./Int32.js";
|
|
2
2
|
import { class_type, TypeInfo } from "./Reflection.js";
|
|
3
3
|
import { fromFloat64, op_Addition, toInt32, toFloat64, compare, int64, fromInt32, toInt64 } from "./BigInt.js";
|
|
4
|
-
import { Operators_IsNull } from "./FSharp.Core.js";
|
|
5
4
|
import { item, fill, setItem } from "./Array.js";
|
|
6
5
|
|
|
7
6
|
function Native_random(): float64 {
|
|
@@ -130,7 +129,7 @@ export class Seeded implements IRandom {
|
|
|
130
129
|
}
|
|
131
130
|
NextBytes(buffer: uint8[]): void {
|
|
132
131
|
const this$: Seeded = this;
|
|
133
|
-
if (
|
|
132
|
+
if (buffer == null) {
|
|
134
133
|
throw new Error("buffer");
|
|
135
134
|
}
|
|
136
135
|
for (let i = 0; i <= (buffer.length - 1); i++) {
|
package/Result.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Union } from "./Types.js";
|
|
2
2
|
import { union_type, TypeInfo } from "./Reflection.js";
|
|
3
|
-
import { int32 } from "./Int32.js";
|
|
4
3
|
import { equals } from "./Util.js";
|
|
4
|
+
import { int32 } from "./Int32.js";
|
|
5
5
|
import { FSharpList, empty, singleton } from "./List.js";
|
|
6
6
|
import { Option, some } from "./Option.js";
|
|
7
7
|
|
|
@@ -36,34 +36,34 @@ export function FSharpResult$2_$reflection(gen0: TypeInfo, gen1: TypeInfo): Type
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
export function Result_Map<a, b, c>(mapping: ((arg0: a) => b), result: FSharpResult$2_$union<a, c>): FSharpResult$2_$union<b, c> {
|
|
39
|
-
if (
|
|
40
|
-
return FSharpResult$2_Ok<b, c>(mapping(result.fields[0]
|
|
39
|
+
if (result.tag === /* Ok */ 0) {
|
|
40
|
+
return FSharpResult$2_Ok<b, c>(mapping(result.fields[0]));
|
|
41
41
|
}
|
|
42
42
|
else {
|
|
43
|
-
return FSharpResult$2_Error<b, c>(result.fields[0]
|
|
43
|
+
return FSharpResult$2_Error<b, c>(result.fields[0]);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
export function Result_MapError<a, b, c>(mapping: ((arg0: a) => b), result: FSharpResult$2_$union<c, a>): FSharpResult$2_$union<c, b> {
|
|
48
|
-
if (
|
|
49
|
-
return FSharpResult$2_Ok<c, b>(result.fields[0]
|
|
48
|
+
if (result.tag === /* Ok */ 0) {
|
|
49
|
+
return FSharpResult$2_Ok<c, b>(result.fields[0]);
|
|
50
50
|
}
|
|
51
51
|
else {
|
|
52
|
-
return FSharpResult$2_Error<c, b>(mapping(result.fields[0]
|
|
52
|
+
return FSharpResult$2_Error<c, b>(mapping(result.fields[0]));
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
export function Result_Bind<a, b, c>(binder: ((arg0: a) => FSharpResult$2_$union<b, c>), result: FSharpResult$2_$union<a, c>): FSharpResult$2_$union<b, c> {
|
|
57
|
-
if (
|
|
58
|
-
return binder(result.fields[0]
|
|
57
|
+
if (result.tag === /* Ok */ 0) {
|
|
58
|
+
return binder(result.fields[0]);
|
|
59
59
|
}
|
|
60
60
|
else {
|
|
61
|
-
return FSharpResult$2_Error<b, c>(result.fields[0]
|
|
61
|
+
return FSharpResult$2_Error<b, c>(result.fields[0]);
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
export function Result_IsOk<a, b>(result: FSharpResult$2_$union<a, b>): boolean {
|
|
66
|
-
if (
|
|
66
|
+
if (result.tag === /* Ok */ 0) {
|
|
67
67
|
return true;
|
|
68
68
|
}
|
|
69
69
|
else {
|
|
@@ -72,7 +72,7 @@ export function Result_IsOk<a, b>(result: FSharpResult$2_$union<a, b>): boolean
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
export function Result_IsError<a, b>(result: FSharpResult$2_$union<a, b>): boolean {
|
|
75
|
-
if (
|
|
75
|
+
if (result.tag === /* Ok */ 0) {
|
|
76
76
|
return false;
|
|
77
77
|
}
|
|
78
78
|
else {
|
|
@@ -81,8 +81,8 @@ export function Result_IsError<a, b>(result: FSharpResult$2_$union<a, b>): boole
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
export function Result_Contains<a, b>(value: a, result: FSharpResult$2_$union<a, b>): boolean {
|
|
84
|
-
if (
|
|
85
|
-
return equals(result.fields[0]
|
|
84
|
+
if (result.tag === /* Ok */ 0) {
|
|
85
|
+
return equals(result.fields[0], value);
|
|
86
86
|
}
|
|
87
87
|
else {
|
|
88
88
|
return false;
|
|
@@ -90,7 +90,7 @@ export function Result_Contains<a, b>(value: a, result: FSharpResult$2_$union<a,
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
export function Result_Count<a, b>(result: FSharpResult$2_$union<a, b>): int32 {
|
|
93
|
-
if (
|
|
93
|
+
if (result.tag === /* Ok */ 0) {
|
|
94
94
|
return 1;
|
|
95
95
|
}
|
|
96
96
|
else {
|
|
@@ -99,8 +99,8 @@ export function Result_Count<a, b>(result: FSharpResult$2_$union<a, b>): int32 {
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
export function Result_DefaultValue<a, b>(defaultValue: a, result: FSharpResult$2_$union<a, b>): a {
|
|
102
|
-
if (
|
|
103
|
-
return result.fields[0]
|
|
102
|
+
if (result.tag === /* Ok */ 0) {
|
|
103
|
+
return result.fields[0];
|
|
104
104
|
}
|
|
105
105
|
else {
|
|
106
106
|
return defaultValue;
|
|
@@ -108,17 +108,17 @@ export function Result_DefaultValue<a, b>(defaultValue: a, result: FSharpResult$
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
export function Result_DefaultWith<b, a>(defThunk: ((arg0: b) => a), result: FSharpResult$2_$union<a, b>): a {
|
|
111
|
-
if (
|
|
112
|
-
return result.fields[0]
|
|
111
|
+
if (result.tag === /* Ok */ 0) {
|
|
112
|
+
return result.fields[0];
|
|
113
113
|
}
|
|
114
114
|
else {
|
|
115
|
-
return defThunk(result.fields[0]
|
|
115
|
+
return defThunk(result.fields[0]);
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
export function Result_Exists<a, b>(predicate: ((arg0: a) => boolean), result: FSharpResult$2_$union<a, b>): boolean {
|
|
120
|
-
if (
|
|
121
|
-
return predicate(result.fields[0]
|
|
120
|
+
if (result.tag === /* Ok */ 0) {
|
|
121
|
+
return predicate(result.fields[0]);
|
|
122
122
|
}
|
|
123
123
|
else {
|
|
124
124
|
return false;
|
|
@@ -126,8 +126,8 @@ export function Result_Exists<a, b>(predicate: ((arg0: a) => boolean), result: F
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
export function Result_Fold<a, b, s>(folder: ((arg0: s, arg1: a) => s), state: s, result: FSharpResult$2_$union<a, b>): s {
|
|
129
|
-
if (
|
|
130
|
-
return folder(state, result.fields[0]
|
|
129
|
+
if (result.tag === /* Ok */ 0) {
|
|
130
|
+
return folder(state, result.fields[0]);
|
|
131
131
|
}
|
|
132
132
|
else {
|
|
133
133
|
return state;
|
|
@@ -135,8 +135,8 @@ export function Result_Fold<a, b, s>(folder: ((arg0: s, arg1: a) => s), state: s
|
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
export function Result_FoldBack<a, b, s>(folder: ((arg0: a, arg1: s) => s), result: FSharpResult$2_$union<a, b>, state: s): s {
|
|
138
|
-
if (
|
|
139
|
-
return folder(result.fields[0]
|
|
138
|
+
if (result.tag === /* Ok */ 0) {
|
|
139
|
+
return folder(result.fields[0], state);
|
|
140
140
|
}
|
|
141
141
|
else {
|
|
142
142
|
return state;
|
|
@@ -144,8 +144,8 @@ export function Result_FoldBack<a, b, s>(folder: ((arg0: a, arg1: s) => s), resu
|
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
export function Result_ForAll<a, b>(predicate: ((arg0: a) => boolean), result: FSharpResult$2_$union<a, b>): boolean {
|
|
147
|
-
if (
|
|
148
|
-
return predicate(result.fields[0]
|
|
147
|
+
if (result.tag === /* Ok */ 0) {
|
|
148
|
+
return predicate(result.fields[0]);
|
|
149
149
|
}
|
|
150
150
|
else {
|
|
151
151
|
return true;
|
|
@@ -153,14 +153,14 @@ export function Result_ForAll<a, b>(predicate: ((arg0: a) => boolean), result: F
|
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
export function Result_Iterate<a, b>(action: ((arg0: a) => void), result: FSharpResult$2_$union<a, b>): void {
|
|
156
|
-
if (
|
|
157
|
-
action(result.fields[0]
|
|
156
|
+
if (result.tag === /* Ok */ 0) {
|
|
157
|
+
action(result.fields[0]);
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
export function Result_ToArray<a, b>(result: FSharpResult$2_$union<a, b>): a[] {
|
|
162
|
-
if (
|
|
163
|
-
return [result.fields[0]
|
|
162
|
+
if (result.tag === /* Ok */ 0) {
|
|
163
|
+
return [result.fields[0]];
|
|
164
164
|
}
|
|
165
165
|
else {
|
|
166
166
|
return [];
|
|
@@ -168,8 +168,8 @@ export function Result_ToArray<a, b>(result: FSharpResult$2_$union<a, b>): a[] {
|
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
export function Result_ToList<a, b>(result: FSharpResult$2_$union<a, b>): FSharpList<a> {
|
|
171
|
-
if (
|
|
172
|
-
return singleton(result.fields[0]
|
|
171
|
+
if (result.tag === /* Ok */ 0) {
|
|
172
|
+
return singleton(result.fields[0]);
|
|
173
173
|
}
|
|
174
174
|
else {
|
|
175
175
|
return empty<a>();
|
|
@@ -177,8 +177,8 @@ export function Result_ToList<a, b>(result: FSharpResult$2_$union<a, b>): FSharp
|
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
export function Result_ToOption<a, b>(result: FSharpResult$2_$union<a, b>): Option<a> {
|
|
180
|
-
if (
|
|
181
|
-
return some(result.fields[0]
|
|
180
|
+
if (result.tag === /* Ok */ 0) {
|
|
181
|
+
return some(result.fields[0]);
|
|
182
182
|
}
|
|
183
183
|
else {
|
|
184
184
|
return undefined;
|
|
@@ -186,8 +186,8 @@ export function Result_ToOption<a, b>(result: FSharpResult$2_$union<a, b>): Opti
|
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
export function Result_ToValueOption<a, b>(result: FSharpResult$2_$union<a, b>): Option<a> {
|
|
189
|
-
if (
|
|
190
|
-
return some(result.fields[0]
|
|
189
|
+
if (result.tag === /* Ok */ 0) {
|
|
190
|
+
return some(result.fields[0]);
|
|
191
191
|
}
|
|
192
192
|
else {
|
|
193
193
|
return undefined;
|
package/Seq.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { IComparer, clear, defaultOf, equals, isDisposable, IEqualityComparer, i
|
|
|
2
2
|
import { toString } from "./Types.js";
|
|
3
3
|
import { class_type, TypeInfo } from "./Reflection.js";
|
|
4
4
|
import { some, value as value_1, Option } from "./Option.js";
|
|
5
|
-
import { Operators_Lock, Operators_NullArg
|
|
5
|
+
import { Operators_Lock, Operators_NullArg } from "./FSharp.Core.js";
|
|
6
6
|
import { chunkBySize as chunkBySize_1, permute as permute_1, transpose as transpose_1, map as map_1, windowed as windowed_1, splitInto as splitInto_1, pairwise as pairwise_1, scanBack as scanBack_1, reverse as reverse_1, mapFoldBack as mapFoldBack_1, mapFold as mapFold_1, tryItem as tryItem_1, tryHead as tryHead_1, foldBack2 as foldBack2_1, foldBack as foldBack_1, tryFindIndexBack as tryFindIndexBack_1, tryFindBack as tryFindBack_1, singleton as singleton_1 } from "./Array.js";
|
|
7
7
|
import { length as length_1, tryItem as tryItem_2, isEmpty as isEmpty_1, tryHead as tryHead_2, ofSeq as ofSeq_1, ofArray as ofArray_1, toArray as toArray_1, FSharpList } from "./List.js";
|
|
8
8
|
import { int32 } from "./Int32.js";
|
|
@@ -325,7 +325,7 @@ export function indexNotFound<$a>(): $a {
|
|
|
325
325
|
}
|
|
326
326
|
|
|
327
327
|
export function checkNonNull<$a>(argName: string, arg: $a): void {
|
|
328
|
-
if (
|
|
328
|
+
if (arg == null) {
|
|
329
329
|
Operators_NullArg<void>(argName);
|
|
330
330
|
}
|
|
331
331
|
}
|
package/System.Text.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { replace, format,
|
|
1
|
+
import { replace, format, substring, isNullOrEmpty, join } from "./String.js";
|
|
2
2
|
import { float64, int32 } from "./Int32.js";
|
|
3
3
|
import { class_type, TypeInfo } from "./Reflection.js";
|
|
4
4
|
import { clear, int32ToString } from "./Util.js";
|
|
@@ -53,12 +53,6 @@ export function StringBuilder__Append_244C7CD6(x: StringBuilder, c: string): Str
|
|
|
53
53
|
return x;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
export function StringBuilder__Append_61B1CA(x: StringBuilder, c: string, repeatCount: int32): StringBuilder {
|
|
57
|
-
const s: string = replicate(repeatCount, c);
|
|
58
|
-
void (x.buf.push(s));
|
|
59
|
-
return x;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
56
|
export function StringBuilder__Append_Z524259A4(x: StringBuilder, o: int32): StringBuilder {
|
|
63
57
|
void (x.buf.push(int32ToString(o)));
|
|
64
58
|
return x;
|
package/TimeSpan.ts
CHANGED
|
@@ -35,24 +35,20 @@ export function fromTicks(ticks: number | bigint) {
|
|
|
35
35
|
return Number(BigInt(ticks) / 10000n);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
export function fromDays(d: number
|
|
39
|
-
return create(d,
|
|
38
|
+
export function fromDays(d: number) {
|
|
39
|
+
return create(d, 0, 0, 0);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
export function fromHours(h: number
|
|
43
|
-
return create(
|
|
42
|
+
export function fromHours(h: number) {
|
|
43
|
+
return create(h, 0, 0);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
export function fromMinutes(m: number
|
|
47
|
-
return create(0,
|
|
46
|
+
export function fromMinutes(m: number) {
|
|
47
|
+
return create(0, m, 0);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
export function fromSeconds(s: number
|
|
51
|
-
return create(0, 0,
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export function fromMilliseconds(ms: number | bigint) {
|
|
55
|
-
return Number(ms);
|
|
50
|
+
export function fromSeconds(s: number) {
|
|
51
|
+
return create(0, 0, s);
|
|
56
52
|
}
|
|
57
53
|
|
|
58
54
|
export function days(ts: TimeSpan) {
|
package/package.json
CHANGED