@fable-org/fable-library-js 1.9.0 → 1.10.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,6 +4,7 @@ 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";
7
8
  function indexNotFound() {
8
9
  throw new Error("An index satisfying the predicate was not found in the collection.");
9
10
  }
@@ -773,15 +774,15 @@ export function splitAt(index, array) {
773
774
  return [array.slice(0, (0 + index)), array.slice(index)];
774
775
  }
775
776
  export function compareWith(comparer, source1, source2) {
776
- if (source1 == null) {
777
- if (source2 == null) {
777
+ if (Operators_IsNull(source1)) {
778
+ if (Operators_IsNull(source2)) {
778
779
  return 0;
779
780
  }
780
781
  else {
781
782
  return -1;
782
783
  }
783
784
  }
784
- else if (source2 == null) {
785
+ else if (Operators_IsNull(source2)) {
785
786
  return 1;
786
787
  }
787
788
  else {
@@ -809,15 +810,15 @@ export function compareWith(comparer, source1, source2) {
809
810
  }
810
811
  }
811
812
  export function compareTo(comparer, source1, source2) {
812
- if (source1 == null) {
813
- if (source2 == null) {
813
+ if (Operators_IsNull(source1)) {
814
+ if (Operators_IsNull(source2)) {
814
815
  return 0;
815
816
  }
816
817
  else {
817
818
  return -1;
818
819
  }
819
820
  }
820
- else if (source2 == null) {
821
+ else if (Operators_IsNull(source2)) {
821
822
  return 1;
822
823
  }
823
824
  else {
@@ -841,15 +842,15 @@ export function compareTo(comparer, source1, source2) {
841
842
  }
842
843
  }
843
844
  export function equalsWith(equals, array1, array2) {
844
- if (array1 == null) {
845
- if (array2 == null) {
845
+ if (Operators_IsNull(array1)) {
846
+ if (Operators_IsNull(array2)) {
846
847
  return true;
847
848
  }
848
849
  else {
849
850
  return false;
850
851
  }
851
852
  }
852
- else if (array2 == null) {
853
+ else if (Operators_IsNull(array2)) {
853
854
  return false;
854
855
  }
855
856
  else {
@@ -1223,7 +1224,7 @@ export function resize(xs, newSize, zero, cons) {
1223
1224
  throw new Error("The input must be non-negative.\\nParameter name: newSize");
1224
1225
  }
1225
1226
  const zero_1 = defaultArg(zero, defaultOf());
1226
- if (xs.contents == null) {
1227
+ if (Operators_IsNull(xs.contents)) {
1227
1228
  xs.contents = ((array = Helpers_allocateArrayFromCons(cons, newSize), array.fill(zero_1, 0, (0 + newSize))));
1228
1229
  }
1229
1230
  else {
package/CHANGELOG.md CHANGED
@@ -7,11 +7,17 @@ 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
+
10
16
  ## 1.9.0 - 2025-01-09
11
17
 
12
18
  ### Added
13
19
 
14
- * [JS/TS] Add new `TimSpan` overload support coming from .NET 9 (by @MangelMaxime)
20
+ * [JS/TS] Add new `TimSpane` overload support coming from .NET 9 (by @MangelMaxime)
15
21
 
16
22
  ### Fixed
17
23
 
package/FSharp.Core.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { IDisposable, IEqualityComparer, IComparer } from "./Util.js";
2
- import { Option } from "./Option.js";
2
+ import { Nullable, Option } from "./Option.js";
3
+ import { FSharpChoice$2_$union } from "./Choice.js";
3
4
  import { StringBuilder } from "./System.Text.js";
4
5
  export declare const LanguagePrimitives_GenericEqualityComparer: any;
5
6
  export declare const LanguagePrimitives_GenericEqualityERComparer: any;
@@ -12,6 +13,19 @@ export declare function Operators_FailurePattern(exn: Error): Option<string>;
12
13
  export declare function Operators_NullArg<$a>(x: string): $a;
13
14
  export declare function Operators_Using<T extends IDisposable, R>(resource: T, action: ((arg0: T) => R)): R;
14
15
  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;
15
29
  export declare function ExtraTopLevelOperators_LazyPattern<$a>(input: any): $a;
16
30
  export declare function PrintfModule_PrintFormatToStringBuilderThen<$a, $b>(continuation: (() => $a), builder: StringBuilder, format: any): $b;
17
31
  export declare function PrintfModule_PrintFormatToStringBuilder<$a>(builder: StringBuilder, format: any): $a;
package/FSharp.Core.js CHANGED
@@ -1,5 +1,7 @@
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";
3
5
  import { StringBuilder__Append_Z721C83C5 } from "./System.Text.js";
4
6
  export const LanguagePrimitives_GenericEqualityComparer = {
5
7
  "System.Collections.IEqualityComparer.Equals541DA560"(x, y) {
@@ -54,6 +56,90 @@ export function Operators_Using(resource, action) {
54
56
  export function Operators_Lock(_lockObj, action) {
55
57
  return action();
56
58
  }
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
+ }
57
143
  export function ExtraTopLevelOperators_LazyPattern(input) {
58
144
  return input.Value;
59
145
  }
package/Random.js CHANGED
@@ -1,5 +1,6 @@
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";
3
4
  import { item, fill, setItem } from "./Array.js";
4
5
  function Native_random() {
5
6
  return Math.random();
@@ -111,7 +112,7 @@ export class Seeded {
111
112
  }
112
113
  NextBytes(buffer) {
113
114
  const this$ = this;
114
- if (buffer == null) {
115
+ if (Operators_IsNull(buffer)) {
115
116
  throw new Error("buffer");
116
117
  }
117
118
  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 } from "./FSharp.Core.js";
5
+ import { Operators_Lock, Operators_NullArg, Operators_IsNull } 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 (arg == null) {
300
+ if (Operators_IsNull(arg)) {
301
301
  Operators_NullArg(argName);
302
302
  }
303
303
  }
package/System.Text.d.ts CHANGED
@@ -13,6 +13,7 @@ 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;
16
17
  export declare function StringBuilder__Append_Z524259A4(x: StringBuilder, o: int32): StringBuilder;
17
18
  export declare function StringBuilder__Append_5E38073B(x: StringBuilder, o: float64): StringBuilder;
18
19
  export declare function StringBuilder__Append_Z1FBCCD16(x: StringBuilder, o: boolean): StringBuilder;
package/System.Text.js CHANGED
@@ -1,4 +1,4 @@
1
- import { replace, format, substring, isNullOrEmpty, join } from "./String.js";
1
+ import { replace, format, replicate, 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,6 +41,11 @@ 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
+ }
44
49
  export function StringBuilder__Append_Z524259A4(x, o) {
45
50
  void (x.buf.push(int32ToString(o)));
46
51
  return x;
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.9.0",
6
+ "version": "1.10.0",
7
7
  "description": "Core library used by F# projects compiled with fable.io",
8
8
  "author": "Fable Contributors",
9
9
  "license": "MIT",