@fable-org/fable-library-ts 1.10.0 → 2.0.0-beta.2
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 +1378 -1378
- package/Async.ts +13 -14
- package/BigInt.ts +48 -22
- package/CHANGELOG.md +18 -1
- package/Choice.ts +301 -301
- package/Date.ts +47 -41
- package/Decimal.ts +29 -1
- package/FSharp.Collections.ts +34 -34
- package/FSharp.Core.CompilerServices.ts +37 -37
- package/FSharp.Core.ts +184 -184
- package/Global.ts +37 -37
- package/List.ts +1417 -1417
- package/Map.ts +1552 -1552
- package/MapUtil.ts +3 -0
- package/MutableMap.ts +345 -345
- package/MutableSet.ts +249 -249
- package/Native.ts +11 -11
- package/Numeric.ts +8 -3
- package/Random.ts +181 -181
- package/Range.ts +56 -56
- package/Result.ts +196 -196
- package/Seq.ts +1525 -1525
- package/Seq2.ts +129 -129
- package/Set.ts +1955 -1955
- package/String.ts +81 -10
- package/System.Collections.Generic.ts +380 -380
- package/System.Text.ts +203 -203
- package/Types.ts +1 -1
- package/package.json +1 -1
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/BigInt.ts
CHANGED
|
@@ -130,20 +130,46 @@ export function toByteArray(value: bigint): number[] {
|
|
|
130
130
|
return toSignedBytes(value, isBigEndian) as any as number[];
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
export function
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
export function
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
export function
|
|
133
|
+
export function toIntN_unchecked(bits: number, x: bigint, signed: boolean): bigint {
|
|
134
|
+
return signed ? BigInt.asIntN(bits, x) : BigInt.asUintN(bits, x);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export function toIntN(bits: number, x: bigint, signed: boolean): bigint {
|
|
138
|
+
let higher_bits = abs(x) >> BigInt(bits);
|
|
139
|
+
if (higher_bits !== 0n) {
|
|
140
|
+
const s = signed ? "a signed" : "an unsigned";
|
|
141
|
+
throw new Error(`Value was either too large or too small for ${s} ${bits}-bit integer.`);
|
|
142
|
+
}
|
|
143
|
+
return signed ? BigInt.asIntN(bits, x) : BigInt.asUintN(bits, x);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export function toInt8(x: bigint): int8 { return Number(toIntN(8, x, true)); }
|
|
147
|
+
export function toUInt8(x: bigint): uint8 { return Number(toIntN(8, x, false)); }
|
|
148
|
+
export function toInt16(x: bigint): int16 { return Number(toIntN(16, x, true)); }
|
|
149
|
+
export function toUInt16(x: bigint): uint16 { return Number(toIntN(16, x, false)); }
|
|
150
|
+
export function toInt32(x: bigint): int32 { return Number(toIntN(32, x, true)); }
|
|
151
|
+
export function toUInt32(x: bigint): uint32 { return Number(toIntN(32, x, false)); }
|
|
152
|
+
export function toInt64(x: bigint): int64 { return toIntN(64, x, true); }
|
|
153
|
+
export function toUInt64(x: bigint): uint64 { return toIntN(64, x, false); }
|
|
154
|
+
export function toInt128(x: bigint): int128 { return toIntN(128, x, true); }
|
|
155
|
+
export function toUInt128(x: bigint): uint128 { return toIntN(128, x, false); }
|
|
156
|
+
export function toNativeInt(x: bigint): nativeint { return toIntN(64, x, true); }
|
|
157
|
+
export function toUNativeInt(x: bigint): unativeint { return toIntN(64, x, false); }
|
|
158
|
+
|
|
159
|
+
export function toInt8_unchecked(x: bigint): int8 { return Number(toIntN_unchecked(8, x, true)); }
|
|
160
|
+
export function toUInt8_unchecked(x: bigint): uint8 { return Number(toIntN_unchecked(8, x, false)); }
|
|
161
|
+
export function toInt16_unchecked(x: bigint): int16 { return Number(toIntN_unchecked(16, x, true)); }
|
|
162
|
+
export function toUInt16_unchecked(x: bigint): uint16 { return Number(toIntN_unchecked(16, x, false)); }
|
|
163
|
+
export function toInt32_unchecked(x: bigint): int32 { return Number(toIntN_unchecked(32, x, true)); }
|
|
164
|
+
export function toUInt32_unchecked(x: bigint): uint32 { return Number(toIntN_unchecked(32, x, false)); }
|
|
165
|
+
export function toInt64_unchecked(x: bigint): int64 { return toIntN_unchecked(64, x, true); }
|
|
166
|
+
export function toUInt64_unchecked(x: bigint): uint64 { return toIntN_unchecked(64, x, false); }
|
|
167
|
+
export function toInt128_unchecked(x: bigint): int128 { return toIntN_unchecked(128, x, true); }
|
|
168
|
+
export function toUInt128_unchecked(x: bigint): uint128 { return toIntN_unchecked(128, x, false); }
|
|
169
|
+
export function toNativeInt_unchecked(x: bigint): nativeint { return toIntN_unchecked(64, x, true); }
|
|
170
|
+
export function toUNativeInt_unchecked(x: bigint): unativeint { return toIntN_unchecked(64, x, false); }
|
|
171
|
+
|
|
172
|
+
export function toFloat16(x: bigint): float16 { return Number(x); }
|
|
147
173
|
export function toFloat32(x: bigint): float32 { return Number(x); }
|
|
148
174
|
export function toFloat64(x: bigint): float64 { return Number(x); }
|
|
149
175
|
|
|
@@ -191,14 +217,14 @@ export function modPow(x: bigint, e: bigint, m: bigint): bigint {
|
|
|
191
217
|
export function divRem(x: bigint, y: bigint): [bigint, bigint];
|
|
192
218
|
export function divRem(x: bigint, y: bigint, out: FSharpRef<bigint>): bigint;
|
|
193
219
|
export function divRem(x: bigint, y: bigint, out?: FSharpRef<bigint>): bigint | [bigint, bigint] {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
220
|
+
const div = x / y;
|
|
221
|
+
const rem = x % y;
|
|
222
|
+
if (out === void 0) {
|
|
223
|
+
return [div, rem];
|
|
224
|
+
} else {
|
|
225
|
+
out.contents = rem;
|
|
226
|
+
return div;
|
|
227
|
+
}
|
|
202
228
|
}
|
|
203
229
|
|
|
204
230
|
export function greatestCommonDivisor(x: bigint, y: bigint): bigint {
|
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## Unreleased
|
|
9
9
|
|
|
10
|
+
## 2.0.0-beta.2 - 2025-03-03
|
|
11
|
+
|
|
12
|
+
* [JS/TS] Fix #4049: decimal/bigint to integer conversion checks (by @ncave)
|
|
13
|
+
* [JS/TS] Fix `decimal` to `char` conversion checks (by @ManngelMaxime)
|
|
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)
|
|
17
|
+
* [JS/TS] Fix short `DateTime` and `DateTimeOffset` short format strings (by @MangelMaxime)
|
|
18
|
+
* [JS/TS] Add `C` and `c` format for numeric types (by @MangelMaxime)
|
|
19
|
+
* [JS/TS] Add `B` and `b` format for numeric types (by @MangelMaxime)
|
|
20
|
+
* [JS/TS] Add `n` format for numeric types (by @MangelMaxime)
|
|
21
|
+
* [JS/TS] Fix numeric formats (by @MangelMaxime)
|
|
22
|
+
|
|
23
|
+
## 2.0.0-beta.1 - 2025-02-16
|
|
24
|
+
|
|
25
|
+
* Compiled with Fable 5.0.0-alpha.10
|
|
26
|
+
|
|
10
27
|
## 1.10.0 - 2025-01-23
|
|
11
28
|
|
|
12
29
|
### Added
|
|
@@ -55,7 +72,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
55
72
|
|
|
56
73
|
* [JS/TS] Fix escaping of `{` and `}` in FormattableString (#3890) (by @roboz0r)
|
|
57
74
|
* [JS/TS] Fix `uri.Host` to return the host name without the port (by @MangelMaxime)
|
|
58
|
-
* [JS/TS] Fix TypeScript compilation by resolving type of `jsOptions` (#3894) (by @
|
|
75
|
+
* [JS/TS] Fix TypeScript compilation by resolving type of `jsOptions` (#3894) (by @MangelMaxime)
|
|
59
76
|
|
|
60
77
|
## 1.4.3 - 2024-09-04
|
|
61
78
|
|