@fable-org/fable-library-js 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.js CHANGED
@@ -4,7 +4,6 @@ import { value as value_2, map as map_1, defaultArg, some } from "./Option.js";
4
4
  import { min as min_1, max as max_1 } from "./Double.js";
5
5
  import { equals as equals_1, disposeSafe, getEnumerator, copyToArray, defaultOf } from "./Util.js";
6
6
  import { SR_indexOutOfBounds } from "./Global.js";
7
- import { Operators_IsNull } from "./FSharp.Core.js";
8
7
  function indexNotFound() {
9
8
  throw new Error("An index satisfying the predicate was not found in the collection.");
10
9
  }
@@ -774,15 +773,15 @@ export function splitAt(index, array) {
774
773
  return [array.slice(0, (0 + index)), array.slice(index)];
775
774
  }
776
775
  export function compareWith(comparer, source1, source2) {
777
- if (Operators_IsNull(source1)) {
778
- if (Operators_IsNull(source2)) {
776
+ if (source1 == null) {
777
+ if (source2 == null) {
779
778
  return 0;
780
779
  }
781
780
  else {
782
781
  return -1;
783
782
  }
784
783
  }
785
- else if (Operators_IsNull(source2)) {
784
+ else if (source2 == null) {
786
785
  return 1;
787
786
  }
788
787
  else {
@@ -810,15 +809,15 @@ export function compareWith(comparer, source1, source2) {
810
809
  }
811
810
  }
812
811
  export function compareTo(comparer, source1, source2) {
813
- if (Operators_IsNull(source1)) {
814
- if (Operators_IsNull(source2)) {
812
+ if (source1 == null) {
813
+ if (source2 == null) {
815
814
  return 0;
816
815
  }
817
816
  else {
818
817
  return -1;
819
818
  }
820
819
  }
821
- else if (Operators_IsNull(source2)) {
820
+ else if (source2 == null) {
822
821
  return 1;
823
822
  }
824
823
  else {
@@ -842,15 +841,15 @@ export function compareTo(comparer, source1, source2) {
842
841
  }
843
842
  }
844
843
  export function equalsWith(equals, array1, array2) {
845
- if (Operators_IsNull(array1)) {
846
- if (Operators_IsNull(array2)) {
844
+ if (array1 == null) {
845
+ if (array2 == null) {
847
846
  return true;
848
847
  }
849
848
  else {
850
849
  return false;
851
850
  }
852
851
  }
853
- else if (Operators_IsNull(array2)) {
852
+ else if (array2 == null) {
854
853
  return false;
855
854
  }
856
855
  else {
@@ -1224,7 +1223,7 @@ export function resize(xs, newSize, zero, cons) {
1224
1223
  throw new Error("The input must be non-negative.\\nParameter name: newSize");
1225
1224
  }
1226
1225
  const zero_1 = defaultArg(zero, defaultOf());
1227
- if (Operators_IsNull(xs.contents)) {
1226
+ if (xs.contents == null) {
1228
1227
  xs.contents = ((array = Helpers_allocateArrayFromCons(cons, newSize), array.fill(zero_1, 0, (0 + newSize))));
1229
1228
  }
1230
1229
  else {
package/Async.d.ts CHANGED
@@ -20,8 +20,7 @@ export declare function ignore<T>(computation: Async<T>): (ctx: IAsyncContext<un
20
20
  export declare function parallel<T>(computations: Iterable<Async<T>>): (ctx: IAsyncContext<Awaited<T>[]>) => void;
21
21
  export declare function sequential<T>(computations: Iterable<Async<T>>): (ctx: IAsyncContext<T[]>) => void;
22
22
  export declare function sleep(millisecondsDueTime: number): (ctx: IAsyncContext<void>) => void;
23
- export declare function runSynchronously(): never;
24
23
  export declare function start<T>(computation: Async<T>, cancellationToken?: CancellationToken): void;
25
24
  export declare function startImmediate<T>(computation: Async<T>, cancellationToken?: CancellationToken): void;
26
- export declare function startWithContinuations<T>(computation: Async<T>, continuation?: Continuation<T> | CancellationToken, exceptionContinuation?: Continuation<any>, cancellationContinuation?: Continuation<any>, cancelToken?: CancellationToken): void;
25
+ export declare function startWithContinuations<T>(computation: Async<T>, continuation: Continuation<T>, exceptionContinuation: Continuation<any>, cancellationContinuation: Continuation<any>, cancelToken?: CancellationToken): void;
27
26
  export declare function startAsPromise<T>(computation: Async<T>, cancellationToken?: CancellationToken): Promise<T>;
package/Async.js CHANGED
@@ -124,25 +124,18 @@ export function sleep(millisecondsDueTime) {
124
124
  });
125
125
  });
126
126
  }
127
- export function runSynchronously() {
128
- throw new Error("Asynchronous code cannot be run synchronously in JS");
129
- }
130
127
  export function start(computation, cancellationToken) {
131
- return startWithContinuations(computation, cancellationToken);
128
+ return startWithContinuations(computation, emptyContinuation, function (err) { throw err; }, emptyContinuation, cancellationToken);
132
129
  }
133
130
  export function startImmediate(computation, cancellationToken) {
134
131
  return start(computation, cancellationToken);
135
132
  }
136
133
  export function startWithContinuations(computation, continuation, exceptionContinuation, cancellationContinuation, cancelToken) {
137
- if (typeof continuation !== "function") {
138
- cancelToken = continuation;
139
- continuation = undefined;
140
- }
141
134
  const trampoline = new Trampoline();
142
135
  computation({
143
136
  onSuccess: continuation ? continuation : emptyContinuation,
144
- onError: exceptionContinuation ? exceptionContinuation : emptyContinuation,
145
- onCancel: cancellationContinuation ? cancellationContinuation : emptyContinuation,
137
+ onError: exceptionContinuation,
138
+ onCancel: cancellationContinuation,
146
139
  cancelToken: cancelToken ? cancelToken : defaultCancellationToken,
147
140
  trampoline,
148
141
  });
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.10.0 - 2025-01-23
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] Fix `DateTimeOffset.ToLocalTime` (by @MangelMaxime)
25
-
26
- ## 1.8.0 - 2024-11-19
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/Date.js CHANGED
@@ -145,12 +145,10 @@ function dateToStringWithCustomFormat(date, format, utc) {
145
145
  cursorPos += tokenLength;
146
146
  switch (tokenLength) {
147
147
  case 1:
148
- const h1Value = hour(localizedDate) % 12;
149
- result += h1Value ? h1Value : 12;
148
+ result += hour(localizedDate) % 12;
150
149
  break;
151
150
  case 2:
152
- const h2Value = hour(localizedDate) % 12;
153
- result += padWithZeros(h2Value ? h2Value : 12, 2);
151
+ result += padWithZeros(hour(localizedDate) % 12, 2);
154
152
  break;
155
153
  default:
156
154
  break;
package/DateOffset.d.ts CHANGED
@@ -31,7 +31,6 @@ export declare function now(): IDateTimeOffset;
31
31
  export declare function utcNow(): IDateTimeOffset;
32
32
  export declare function toUniversalTime(date: IDateTimeOffset): Date;
33
33
  export declare function toLocalTime(date: IDateTimeOffset): Date;
34
- export declare function localDateTime(date: IDateTimeOffset): Date;
35
34
  export declare function timeOfDay(d: IDateTimeOffset): number;
36
35
  export declare function date(d: IDateTimeOffset): IDateTime;
37
36
  export declare function day(d: IDateTimeOffset): number;
package/DateOffset.js CHANGED
@@ -141,9 +141,6 @@ export function toUniversalTime(date) {
141
141
  return DateTime(date.getTime(), 1 /* DateKind.UTC */);
142
142
  }
143
143
  export function toLocalTime(date) {
144
- return DateTime(date.getTime() + offset(now()), 2 /* DateKind.Local */);
145
- }
146
- export function localDateTime(date) {
147
144
  return DateTime(date.getTime(), 2 /* DateKind.Local */);
148
145
  }
149
146
  export function timeOfDay(d) {
package/FSharp.Core.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { IDisposable, IEqualityComparer, IComparer } from "./Util.js";
2
- import { Nullable, Option } from "./Option.js";
3
- import { FSharpChoice$2_$union } from "./Choice.js";
2
+ import { Option } from "./Option.js";
4
3
  import { StringBuilder } from "./System.Text.js";
5
4
  export declare const LanguagePrimitives_GenericEqualityComparer: any;
6
5
  export declare const LanguagePrimitives_GenericEqualityERComparer: any;
@@ -13,19 +12,6 @@ export declare function Operators_FailurePattern(exn: Error): Option<string>;
13
12
  export declare function Operators_NullArg<$a>(x: string): $a;
14
13
  export declare function Operators_Using<T extends IDisposable, R>(resource: T, action: ((arg0: T) => R)): R;
15
14
  export declare function Operators_Lock<$a, $b>(_lockObj: $a, action: (() => $b)): $b;
16
- export declare function Operators_IsNull<T>(value: T): boolean;
17
- export declare function Operators_IsNotNull<T>(value: T): boolean;
18
- export declare function Operators_IsNullV<T extends any>(value: Nullable<T>): boolean;
19
- export declare function Operators_NonNull<T>(value: T): T;
20
- export declare function Operators_NonNullV<T extends any>(value: Nullable<T>): T;
21
- export declare function Operators_NullMatchPattern<T>(value: T): FSharpChoice$2_$union<void, T>;
22
- export declare function Operators_NullValueMatchPattern<T extends any>(value: Nullable<T>): FSharpChoice$2_$union<void, T>;
23
- export declare function Operators_NonNullQuickPattern<T>(value: T): T;
24
- export declare function Operators_NonNullQuickValuePattern<T extends any>(value: Nullable<T>): T;
25
- export declare function Operators_WithNull<T>(value: T): T;
26
- export declare function Operators_WithNullV<T extends any>(value: T): T;
27
- export declare function Operators_NullV<T extends any>(): Nullable<T>;
28
- export declare function Operators_NullArgCheck<T>(argumentName: string, value: T): T;
29
15
  export declare function ExtraTopLevelOperators_LazyPattern<$a>(input: any): $a;
30
16
  export declare function PrintfModule_PrintFormatToStringBuilderThen<$a, $b>(continuation: (() => $a), builder: StringBuilder, format: any): $b;
31
17
  export declare function PrintfModule_PrintFormatToStringBuilder<$a>(builder: StringBuilder, format: any): $a;
package/FSharp.Core.js CHANGED
@@ -1,7 +1,5 @@
1
1
  import { disposeSafe, defaultOf, 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";
4
- import { FSharpChoice$2_Choice2Of2, FSharpChoice$2_Choice1Of2 } from "./Choice.js";
5
3
  import { StringBuilder__Append_Z721C83C5 } from "./System.Text.js";
6
4
  export const LanguagePrimitives_GenericEqualityComparer = {
7
5
  "System.Collections.IEqualityComparer.Equals541DA560"(x, y) {
@@ -56,90 +54,6 @@ export function Operators_Using(resource, action) {
56
54
  export function Operators_Lock(_lockObj, action) {
57
55
  return action();
58
56
  }
59
- export function Operators_IsNull(value) {
60
- if (equals(value, defaultOf())) {
61
- return true;
62
- }
63
- else {
64
- return false;
65
- }
66
- }
67
- export function Operators_IsNotNull(value) {
68
- if (equals(value, defaultOf())) {
69
- return false;
70
- }
71
- else {
72
- return true;
73
- }
74
- }
75
- export function Operators_IsNullV(value) {
76
- return !(value != null);
77
- }
78
- export function Operators_NonNull(value) {
79
- if (equals(value, defaultOf())) {
80
- throw new Error();
81
- }
82
- else {
83
- return value;
84
- }
85
- }
86
- export function Operators_NonNullV(value) {
87
- if (value != null) {
88
- return value_1(value);
89
- }
90
- else {
91
- throw new Error();
92
- }
93
- }
94
- export function Operators_NullMatchPattern(value) {
95
- if (equals(value, defaultOf())) {
96
- return FSharpChoice$2_Choice1Of2(undefined);
97
- }
98
- else {
99
- return FSharpChoice$2_Choice2Of2(value);
100
- }
101
- }
102
- export function Operators_NullValueMatchPattern(value) {
103
- if (value != null) {
104
- return FSharpChoice$2_Choice2Of2(value_1(value));
105
- }
106
- else {
107
- return FSharpChoice$2_Choice1Of2(undefined);
108
- }
109
- }
110
- export function Operators_NonNullQuickPattern(value) {
111
- if (equals(value, defaultOf())) {
112
- throw new Error();
113
- }
114
- else {
115
- return value;
116
- }
117
- }
118
- export function Operators_NonNullQuickValuePattern(value) {
119
- if (value != null) {
120
- return value_1(value);
121
- }
122
- else {
123
- throw new Error();
124
- }
125
- }
126
- export function Operators_WithNull(value) {
127
- return value;
128
- }
129
- export function Operators_WithNullV(value) {
130
- return value;
131
- }
132
- export function Operators_NullV() {
133
- return defaultOf();
134
- }
135
- export function Operators_NullArgCheck(argumentName, value) {
136
- if (equals(value, defaultOf())) {
137
- throw new Error(argumentName);
138
- }
139
- else {
140
- return value;
141
- }
142
- }
143
57
  export function ExtraTopLevelOperators_LazyPattern(input) {
144
58
  return input.Value;
145
59
  }
package/Random.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { class_type } from "./Reflection.js";
2
2
  import { fromFloat64, op_Addition, toInt32, toFloat64, compare, fromInt32, toInt64 } from "./BigInt.js";
3
- import { Operators_IsNull } from "./FSharp.Core.js";
4
3
  import { item, fill, setItem } from "./Array.js";
5
4
  function Native_random() {
6
5
  return Math.random();
@@ -112,7 +111,7 @@ export class Seeded {
112
111
  }
113
112
  NextBytes(buffer) {
114
113
  const this$ = this;
115
- if (Operators_IsNull(buffer)) {
114
+ if (buffer == null) {
116
115
  throw new Error("buffer");
117
116
  }
118
117
  for (let i = 0; i <= (buffer.length - 1); i++) {
package/Seq.js CHANGED
@@ -2,7 +2,7 @@ import { clear, defaultOf, equals, isDisposable, isArrayLike, toIterator, dispos
2
2
  import { toString } from "./Types.js";
3
3
  import { class_type } from "./Reflection.js";
4
4
  import { some, value as value_1 } from "./Option.js";
5
- import { Operators_Lock, Operators_NullArg, Operators_IsNull } from "./FSharp.Core.js";
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 { SR_indexOutOfBounds } from "./Global.js";
@@ -297,7 +297,7 @@ export function indexNotFound() {
297
297
  throw new Error(SR_keyNotFoundAlt);
298
298
  }
299
299
  export function checkNonNull(argName, arg) {
300
- if (Operators_IsNull(arg)) {
300
+ if (arg == null) {
301
301
  Operators_NullArg(argName);
302
302
  }
303
303
  }
package/System.Text.d.ts CHANGED
@@ -13,7 +13,6 @@ export declare function StringBuilder_$ctor(): StringBuilder;
13
13
  export declare function StringBuilder__Append_Z721C83C5(x: StringBuilder, s: string): StringBuilder;
14
14
  export declare function StringBuilder__Append_487EF8FB(x: StringBuilder, s: string, startIndex: int32, count: int32): StringBuilder;
15
15
  export declare function StringBuilder__Append_244C7CD6(x: StringBuilder, c: string): StringBuilder;
16
- export declare function StringBuilder__Append_61B1CA(x: StringBuilder, c: string, repeatCount: int32): StringBuilder;
17
16
  export declare function StringBuilder__Append_Z524259A4(x: StringBuilder, o: int32): StringBuilder;
18
17
  export declare function StringBuilder__Append_5E38073B(x: StringBuilder, o: float64): StringBuilder;
19
18
  export declare function StringBuilder__Append_Z1FBCCD16(x: StringBuilder, o: boolean): StringBuilder;
package/System.Text.js CHANGED
@@ -1,4 +1,4 @@
1
- import { replace, format, replicate, substring, isNullOrEmpty, join } from "./String.js";
1
+ import { replace, format, substring, isNullOrEmpty, join } from "./String.js";
2
2
  import { class_type } from "./Reflection.js";
3
3
  import { clear, int32ToString } from "./Util.js";
4
4
  import { toString } from "./Types.js";
@@ -41,11 +41,6 @@ export function StringBuilder__Append_244C7CD6(x, c) {
41
41
  void (x.buf.push(c));
42
42
  return x;
43
43
  }
44
- export function StringBuilder__Append_61B1CA(x, c, repeatCount) {
45
- const s = replicate(repeatCount, c);
46
- void (x.buf.push(s));
47
- return x;
48
- }
49
44
  export function StringBuilder__Append_Z524259A4(x, o) {
50
45
  void (x.buf.push(int32ToString(o)));
51
46
  return x;
package/TimeSpan.d.ts CHANGED
@@ -3,11 +3,10 @@ import { comparePrimitives } from "./Util.js";
3
3
  export type TimeSpan = number;
4
4
  export declare function create(d?: number, h?: number, m?: number, s?: number, ms?: number): number;
5
5
  export declare function fromTicks(ticks: number | bigint): number;
6
- export declare function fromDays(d: number, h?: number, m?: bigint, s?: bigint, ms?: bigint): number;
7
- export declare function fromHours(h: number, m?: bigint, s?: bigint, ms?: bigint): number;
8
- export declare function fromMinutes(m: number | bigint, s?: bigint, ms?: bigint): number;
9
- export declare function fromSeconds(s: number | bigint, ms?: bigint): number;
10
- export declare function fromMilliseconds(ms: number | bigint): number;
6
+ export declare function fromDays(d: number): number;
7
+ export declare function fromHours(h: number): number;
8
+ export declare function fromMinutes(m: number): number;
9
+ export declare function fromSeconds(s: number): number;
11
10
  export declare function days(ts: TimeSpan): number;
12
11
  export declare function hours(ts: TimeSpan): number;
13
12
  export declare function minutes(ts: TimeSpan): number;
package/TimeSpan.js CHANGED
@@ -27,20 +27,17 @@ export function create(d = 0, h = 0, m = 0, s = 0, ms = 0) {
27
27
  export function fromTicks(ticks) {
28
28
  return Number(BigInt(ticks) / 10000n);
29
29
  }
30
- export function fromDays(d, h = 0, m = 0n, s = 0n, ms = 0n) {
31
- return create(d, h, Number(m), Number(s), Number(ms));
30
+ export function fromDays(d) {
31
+ return create(d, 0, 0, 0);
32
32
  }
33
- export function fromHours(h, m = 0n, s = 0n, ms = 0n) {
34
- return create(0, h, Number(m), Number(s), Number(ms));
33
+ export function fromHours(h) {
34
+ return create(h, 0, 0);
35
35
  }
36
- export function fromMinutes(m, s = 0n, ms = 0n) {
37
- return create(0, 0, Number(m), Number(s), Number(ms));
36
+ export function fromMinutes(m) {
37
+ return create(0, m, 0);
38
38
  }
39
- export function fromSeconds(s, ms = 0n) {
40
- return create(0, 0, 0, Number(s), Number(ms));
41
- }
42
- export function fromMilliseconds(ms) {
43
- return Number(ms);
39
+ export function fromSeconds(s) {
40
+ return create(0, 0, s);
44
41
  }
45
42
  export function days(ts) {
46
43
  return signedRound(ts / 86400000);
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "private": false,
4
4
  "type": "module",
5
5
  "name": "@fable-org/fable-library-js",
6
- "version": "1.10.0",
6
+ "version": "1.11.0",
7
7
  "description": "Core library used by F# projects compiled with fable.io",
8
8
  "author": "Fable Contributors",
9
9
  "license": "MIT",