@magnusopera/fscript 0.77.1 → 0.79.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/dist/FScript.Language/Ast.js +2 -2
- package/dist/FScript.Language/BuiltinFunctions.js +68 -67
- package/dist/FScript.Language/BuiltinSignatures.js +7 -7
- package/dist/FScript.Language/BuiltinTypes.js +3 -3
- package/dist/FScript.Language/Error.js +2 -2
- package/dist/FScript.Language/Eval.js +305 -213
- package/dist/FScript.Language/IncludeResolver.js +97 -79
- package/dist/FScript.Language/Interactive.js +149 -0
- package/dist/FScript.Language/Lexer.js +77 -77
- package/dist/FScript.Language/Parser.js +274 -272
- package/dist/FScript.Language/Pretty.js +4 -4
- package/dist/FScript.Language/Span.js +2 -2
- package/dist/FScript.Language/Token.js +59 -2
- package/dist/FScript.Language/TypeInfer.js +704 -379
- package/dist/FScript.Language/Types.js +98 -27
- package/dist/FScript.Language/Value.js +3 -2
- package/dist/Library.js +91 -79
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Array.js +36 -35
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Async.js +52 -23
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/AsyncBuilder.js +23 -2
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/BigInt.js +33 -32
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/BitConverter.js +2 -2
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/CHANGELOG.md +80 -1
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Date.js +8 -15
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/DateOffset.js +8 -17
- package/dist/fable_modules/fable-library-js.5.13.0/Directory.js +11 -0
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Double.js +8 -2
- package/dist/fable_modules/fable-library-js.5.13.0/Environment.js +3 -0
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Event.js +10 -1
- package/dist/fable_modules/fable-library-js.5.13.0/File.js +27 -0
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/List.js +35 -21
- package/dist/fable_modules/fable-library-js.5.13.0/Long.js +38 -0
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/MailboxProcessor.js +11 -5
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Map.js +8 -4
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/MutableMap.js +2 -2
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/MutableSet.js +1 -1
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Observable.js +5 -3
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Option.js +1 -18
- package/dist/fable_modules/fable-library-js.5.13.0/Path.js +31 -0
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Reflection.js +13 -3
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/RegExp.js +53 -24
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Seq.js +109 -22
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Set.js +16 -3
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/String.js +28 -1
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/System.js +15 -9
- package/dist/fable_modules/fable-library-js.5.13.0/Task.js +27 -0
- package/dist/fable_modules/fable-library-js.5.13.0/TaskBuilder.js +72 -0
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Types.js +12 -12
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Util.js +15 -3
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/package.json +1 -1
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/quotation.js +25 -8
- package/dist/fable_modules/project_cracked.json +1 -1
- package/package.json +2 -2
- package/dist/fable_modules/fable-library-js.5.2.0/Long.js +0 -47
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Boolean.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Char.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Choice.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/CollectionUtil.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/ConditionalWeakTable.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/DateOnly.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Decimal.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Encoding.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/FSharp.Collections.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/FSharp.Core.CompilerServices.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/FSharp.Core.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Global.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Guid.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Int32.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/MapUtil.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Native.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Numeric.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/README.md +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Random.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Range.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Result.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Seq2.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/System.Collections.Generic.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/System.Text.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/TimeOnly.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/TimeSpan.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Timer.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Unicode.13.0.0.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Uri.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/big.d.ts +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/lib/big.js +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
last_commit_released:
|
|
2
|
+
last_commit_released: 619d7afddbaf25108e819abaaa9d8a6503c457d6
|
|
3
3
|
updaters:
|
|
4
4
|
- package.json:
|
|
5
5
|
file: package.json
|
|
@@ -15,6 +15,85 @@ All notable changes to this project will be documented in this file.
|
|
|
15
15
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
16
16
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
17
17
|
|
|
18
|
+
## 2.5.1 - 2026-07-24
|
|
19
|
+
|
|
20
|
+
### 🐞 Bug Fixes
|
|
21
|
+
|
|
22
|
+
* *(js/ts,python)* Inline Option/ValueOption combinators to avoid closures and allocations (#4836) ([61cac646](https://github.com/fable-compiler/Fable/commit/61cac646e6385d82247082dbb90a98b1646560de))
|
|
23
|
+
|
|
24
|
+
<strong><small>[View changes on Github](https://github.com/fable-compiler/Fable/compare/6568f35ece227fc30ce84111c8d2e975b09bac00..619d7afddbaf25108e819abaaa9d8a6503c457d6)</small></strong>
|
|
25
|
+
|
|
26
|
+
## 2.5.0 - 2026-07-15
|
|
27
|
+
|
|
28
|
+
### 🚀 Features
|
|
29
|
+
|
|
30
|
+
* *(js/ts)* Add `System.IO.Directory` support (Exists, CreateDirectory) (#4798) ([6568f35e](https://github.com/fable-compiler/Fable/commit/6568f35ece227fc30ce84111c8d2e975b09bac00))
|
|
31
|
+
* *(js/ts/python/beam)* Preserve member calls and pattern matches in quotations (#4780) ([55482e6b](https://github.com/fable-compiler/Fable/commit/55482e6b5e6306fd4dbaba5759024313cb26682a))
|
|
32
|
+
|
|
33
|
+
<strong><small>[View changes on Github](https://github.com/fable-compiler/Fable/compare/a8d9bf5f0b7cc4560bb107963348e765695c22b6..6568f35ece227fc30ce84111c8d2e975b09bac00)</small></strong>
|
|
34
|
+
|
|
35
|
+
## 2.4.2 - 2026-07-11
|
|
36
|
+
|
|
37
|
+
### 🐞 Bug Fixes
|
|
38
|
+
|
|
39
|
+
* *(js/ts)* Async cancellation propagation and continuation double-resolve (#4746) ([c78a9a8e](https://github.com/fable-compiler/Fable/commit/c78a9a8ed20234feddf3375b61e91098f9261bee))
|
|
40
|
+
* *(js/ts)* Date arithmetic: PM parsing, AddMonths day clamp, AddYears offset (#4744) ([be0558eb](https://github.com/fable-compiler/Fable/commit/be0558ebe07f78f7a93ec0c34592d7c066b59fc7))
|
|
41
|
+
* *(js/ts)* Int64 non-decimal parsing and BitConverter .NET mismatches (#4748) ([2704d9c5](https://github.com/fable-compiler/Fable/commit/2704d9c5daab87eb1791c0ea1b6b8b06b987247c))
|
|
42
|
+
|
|
43
|
+
<strong><small>[View changes on Github](https://github.com/fable-compiler/Fable/compare/d6ae6bd3790b57b31941a118cdffaeb6a59155c3..a8d9bf5f0b7cc4560bb107963348e765695c22b6)</small></strong>
|
|
44
|
+
|
|
45
|
+
## 2.4.1 - 2026-07-09
|
|
46
|
+
|
|
47
|
+
### 🐞 Bug Fixes
|
|
48
|
+
|
|
49
|
+
* MailboxProcessor dropping falsy messages and unit replies ([8299b2e7](https://github.com/fable-compiler/Fable/commit/8299b2e7f690e9136906653155883a08607aa4a4))
|
|
50
|
+
* *(all)* Add `Seq.enumerateTryWith` for try/with in seq, list, array comprehensions (#4750) ([448c90d7](https://github.com/fable-compiler/Fable/commit/448c90d7ccba80ee3d3c38432a2a1d1407f6dc69))
|
|
51
|
+
* *(js/ts)* Match .NET NaN semantics in JS comparison, min and max ([7e5106f9](https://github.com/fable-compiler/Fable/commit/7e5106f9d93cb55ae4aca4656868fa0c53493991))
|
|
52
|
+
* *(js/ts)* BigInteger byte-array corruption, checked conversions, gcd, log2 (#4743) ([f3cb7f2b](https://github.com/fable-compiler/Fable/commit/f3cb7f2bfc9e46e558763867d6c1ba323bcf281c))
|
|
53
|
+
* *(js/ts)* Observable/Event dropping null/undefined/unit values (#4742) ([75bff73b](https://github.com/fable-compiler/Fable/commit/75bff73be3743fe0af37f99c541b10f6978150f3))
|
|
54
|
+
* *(js/ts)* EndsWith regression for empty pattern with non-ordinal comparison ([7793ed7b](https://github.com/fable-compiler/Fable/commit/7793ed7b0fc1f33bf3da6c0ea31607e172726267))
|
|
55
|
+
* *(js/ts/python)* Quote strings with the %A format specifier (#4749) ([75321f3b](https://github.com/fable-compiler/Fable/commit/75321f3b2cb70ea345a0a45d6343cbb6e0de466f))
|
|
56
|
+
* *(ts/js)* `Regex.Replace` count/substitutions and `Regex.Split` semantics (#4741) ([d6ae6bd3](https://github.com/fable-compiler/Fable/commit/d6ae6bd3790b57b31941a118cdffaeb6a59155c3))
|
|
57
|
+
|
|
58
|
+
<strong><small>[View changes on Github](https://github.com/fable-compiler/Fable/compare/7f915f1dd66b9a5fbbd56f858b07d39b98519b65..d6ae6bd3790b57b31941a118cdffaeb6a59155c3)</small></strong>
|
|
59
|
+
|
|
60
|
+
## 2.4.0 - 2026-07-05
|
|
61
|
+
|
|
62
|
+
### 🚀 Features
|
|
63
|
+
|
|
64
|
+
* *(js/ts)* Add `System.IO.Path` and `System.IO.File` API support ([ec99fac5](https://github.com/fable-compiler/Fable/commit/ec99fac5fd7a9428ee54f66f878ef4edad0904cb))
|
|
65
|
+
* *(js/ts/python)* Add Environment and Console.Error support ([6e082f95](https://github.com/fable-compiler/Fable/commit/6e082f955140676da3388a43b55378ea4ad20f1c))
|
|
66
|
+
|
|
67
|
+
### 🐞 Bug Fixes
|
|
68
|
+
|
|
69
|
+
* *(js/ts)* DateTime.ToString() and %A are now consistent across all DateTimeKind values (#4714) ([de98b0e4](https://github.com/fable-compiler/Fable/commit/de98b0e466c8824b0ba8b941d20efae70d232abb))
|
|
70
|
+
|
|
71
|
+
<strong><small>[View changes on Github](https://github.com/fable-compiler/Fable/compare/c977d78b39225a51c7bd051a1fe363ed0ccbe201..7f915f1dd66b9a5fbbd56f858b07d39b98519b65)</small></strong>
|
|
72
|
+
|
|
73
|
+
## 2.3.0 - 2026-06-30
|
|
74
|
+
|
|
75
|
+
### 🚀 Features
|
|
76
|
+
|
|
77
|
+
* *(js/ts)* Map task { } to Promise<T> ([97f54d36](https://github.com/fable-compiler/Fable/commit/97f54d3692e5ba881c249b289c20b4fad5ac27e2))
|
|
78
|
+
* *(js/ts/python/beam)* Add support for `Async.AwaitEvent` (#4693) ([71c98179](https://github.com/fable-compiler/Fable/commit/71c981792b6ff99cd417bb2e70a13a9d55ed72cf))
|
|
79
|
+
|
|
80
|
+
### 🐞 Bug Fixes
|
|
81
|
+
|
|
82
|
+
* *(js)* Respect StringComparison in String.IndexOf/LastIndexOf (#4681) ([7cb92d52](https://github.com/fable-compiler/Fable/commit/7cb92d522e5dc8dfe51351565504c59a94c2f408))
|
|
83
|
+
* *(js/ts)* Int list is not a union type (#4698) ([ecbecbe7](https://github.com/fable-compiler/Fable/commit/ecbecbe756610fd83a621c005e97eda92bbc332a))
|
|
84
|
+
* *(js/ts)* Pass TypeInfo to getRecordFields to handle None fields in anonymous records (#4704) ([c977d78b](https://github.com/fable-compiler/Fable/commit/c977d78b39225a51c7bd051a1fe363ed0ccbe201))
|
|
85
|
+
* *(ts)* Widen isEnumDefined value parameter to accept any value (#4690) ([0d6498dd](https://github.com/fable-compiler/Fable/commit/0d6498ddf65e0e18918690633da23b04b78479f6))
|
|
86
|
+
|
|
87
|
+
<strong><small>[View changes on Github](https://github.com/fable-compiler/Fable/compare/c9b3ee2429a4688946c1936e27df730837428070..c977d78b39225a51c7bd051a1fe363ed0ccbe201)</small></strong>
|
|
88
|
+
|
|
89
|
+
## 2.2.0 - 2026-06-24
|
|
90
|
+
|
|
91
|
+
### 🚀 Features
|
|
92
|
+
|
|
93
|
+
* *(all)* Support Exception.InnerException across all targets (#4677) ([c9b3ee24](https://github.com/fable-compiler/Fable/commit/c9b3ee2429a4688946c1936e27df730837428070))
|
|
94
|
+
|
|
95
|
+
<strong><small>[View changes on Github](https://github.com/fable-compiler/Fable/compare/15eb83ed36657f75073fb0e1b4cac677e24fc9bb..c9b3ee2429a4688946c1936e27df730837428070)</small></strong>
|
|
96
|
+
|
|
18
97
|
## 2.1.1 - 2026-06-10
|
|
19
98
|
|
|
20
99
|
### 🐞 Bug Fixes
|
|
@@ -478,7 +478,7 @@ function dateToString_Y(date) {
|
|
|
478
478
|
function dateToStringWithKind(date, format) {
|
|
479
479
|
const utc = date.kind === DateTimeKind.Utc;
|
|
480
480
|
if (typeof format !== "string") {
|
|
481
|
-
return
|
|
481
|
+
return dateToString_d(date) + " " + dateToString_T(date);
|
|
482
482
|
}
|
|
483
483
|
else if (format.length === 1) {
|
|
484
484
|
switch (format) {
|
|
@@ -595,7 +595,10 @@ export function parseRaw(input) {
|
|
|
595
595
|
parseInt(timeParts[1] || "0", 10) * 60 +
|
|
596
596
|
parseFloat(timeParts[2] || "0");
|
|
597
597
|
if (m[3] != null && m[3].toUpperCase() === "PM" && hourPart < 12) {
|
|
598
|
-
timeInSeconds +=
|
|
598
|
+
timeInSeconds += 12 * 3600;
|
|
599
|
+
}
|
|
600
|
+
else if (m[3] != null && m[3].toUpperCase() === "AM" && hourPart === 12) {
|
|
601
|
+
timeInSeconds -= 12 * 3600;
|
|
599
602
|
}
|
|
600
603
|
}
|
|
601
604
|
if (m[4] != null) { // There's an offset, parse as UTC
|
|
@@ -784,19 +787,9 @@ export function addYears(d, v) {
|
|
|
784
787
|
return create(newYear, newMonth, newDay, hour(d), minute(d), second(d), millisecond(d), d.kind);
|
|
785
788
|
}
|
|
786
789
|
export function addMonths(d, v) {
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
if (newMonth > 12) {
|
|
791
|
-
newMonth_ = newMonth % 12;
|
|
792
|
-
yearOffset = Math.floor(newMonth / 12);
|
|
793
|
-
newMonth = newMonth_;
|
|
794
|
-
}
|
|
795
|
-
else if (newMonth < 1) {
|
|
796
|
-
newMonth_ = 12 + newMonth % 12;
|
|
797
|
-
yearOffset = Math.floor(newMonth / 12) + (newMonth_ === 12 ? -1 : 0);
|
|
798
|
-
newMonth = newMonth_;
|
|
799
|
-
}
|
|
790
|
+
const totalMonths = month(d) + v;
|
|
791
|
+
const newMonth = ((totalMonths - 1) % 12 + 12) % 12 + 1;
|
|
792
|
+
const yearOffset = Math.floor((totalMonths - 1) / 12);
|
|
800
793
|
const newYear = year(d) + yearOffset;
|
|
801
794
|
const _daysInMonth = daysInMonth(newYear, newMonth);
|
|
802
795
|
const newDay = Math.min(_daysInMonth, day(d));
|
|
@@ -203,27 +203,18 @@ export function addTicks(d, v) {
|
|
|
203
203
|
return add(d, toFloat64(v / 10000n));
|
|
204
204
|
}
|
|
205
205
|
export function addYears(d, v) {
|
|
206
|
-
const
|
|
207
|
-
const
|
|
206
|
+
const d2 = new Date(d.getTime() + offset(d));
|
|
207
|
+
const newMonth = d2.getUTCMonth() + 1;
|
|
208
|
+
const newYear = d2.getUTCFullYear() + v;
|
|
208
209
|
const _daysInMonth = daysInMonth(newYear, newMonth);
|
|
209
|
-
const newDay = Math.min(_daysInMonth,
|
|
210
|
-
return create(newYear, newMonth, newDay,
|
|
210
|
+
const newDay = Math.min(_daysInMonth, d2.getUTCDate());
|
|
211
|
+
return create(newYear, newMonth, newDay, d2.getUTCHours(), d2.getUTCMinutes(), d2.getUTCSeconds(), d2.getUTCMilliseconds(), offset(d));
|
|
211
212
|
}
|
|
212
213
|
export function addMonths(d, v) {
|
|
213
214
|
const d2 = new Date(d.getTime() + offset(d));
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
if (newMonth > 12) {
|
|
218
|
-
newMonth_ = newMonth % 12;
|
|
219
|
-
yearOffset = Math.floor(newMonth / 12);
|
|
220
|
-
newMonth = newMonth_;
|
|
221
|
-
}
|
|
222
|
-
else if (newMonth < 1) {
|
|
223
|
-
newMonth_ = 12 + newMonth % 12;
|
|
224
|
-
yearOffset = Math.floor(newMonth / 12) + (newMonth_ === 12 ? -1 : 0);
|
|
225
|
-
newMonth = newMonth_;
|
|
226
|
-
}
|
|
215
|
+
const totalMonths = d2.getUTCMonth() + 1 + v;
|
|
216
|
+
const newMonth = ((totalMonths - 1) % 12 + 12) % 12 + 1;
|
|
217
|
+
const yearOffset = Math.floor((totalMonths - 1) / 12);
|
|
227
218
|
const newYear = d2.getUTCFullYear() + yearOffset;
|
|
228
219
|
const _daysInMonth = daysInMonth(newYear, newMonth);
|
|
229
220
|
const newDay = Math.min(_daysInMonth, d2.getUTCDate());
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// This library doesn't depend on @types/node (to stay browser-compatible),
|
|
2
|
+
// so this Node.js built-in import can't be type-checked; the exported
|
|
3
|
+
// functions below still declare their own types for callers to rely on.
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
import { existsSync, mkdirSync, statSync } from "node:fs";
|
|
6
|
+
export function exists(path) {
|
|
7
|
+
return existsSync(path) && statSync(path).isDirectory();
|
|
8
|
+
}
|
|
9
|
+
export function createDirectory(path) {
|
|
10
|
+
mkdirSync(path, { recursive: true });
|
|
11
|
+
}
|
|
@@ -31,15 +31,21 @@ export function isInfinity(x) {
|
|
|
31
31
|
return x === Number.POSITIVE_INFINITY || x === Number.NEGATIVE_INFINITY;
|
|
32
32
|
}
|
|
33
33
|
export function max(x, y) {
|
|
34
|
-
return x
|
|
34
|
+
return Math.max(x, y);
|
|
35
35
|
}
|
|
36
36
|
export function min(x, y) {
|
|
37
|
-
return x
|
|
37
|
+
return Math.min(x, y);
|
|
38
38
|
}
|
|
39
39
|
export function maxMagnitude(x, y) {
|
|
40
|
+
if (Number.isNaN(x) || Number.isNaN(y)) {
|
|
41
|
+
return NaN;
|
|
42
|
+
}
|
|
40
43
|
return Math.abs(x) > Math.abs(y) ? x : y;
|
|
41
44
|
}
|
|
42
45
|
export function minMagnitude(x, y) {
|
|
46
|
+
if (Number.isNaN(x) || Number.isNaN(y)) {
|
|
47
|
+
return NaN;
|
|
48
|
+
}
|
|
43
49
|
return Math.abs(x) < Math.abs(y) ? x : y;
|
|
44
50
|
}
|
|
45
51
|
export function clamp(x, min, max) {
|
|
@@ -18,8 +18,17 @@ export class Event$2 {
|
|
|
18
18
|
return createEvent(h => { this._add(h); }, h => { this._remove(h); });
|
|
19
19
|
}
|
|
20
20
|
Trigger(senderOrValue, valueOrUndefined) {
|
|
21
|
+
// Disambiguate the overloads by arity, not by value: a two-argument call may
|
|
22
|
+
// legitimately pass `undefined` as the event value (e.g. unit events).
|
|
21
23
|
let sender = null;
|
|
22
|
-
|
|
24
|
+
let value;
|
|
25
|
+
if (arguments.length <= 1) {
|
|
26
|
+
value = senderOrValue;
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
sender = senderOrValue;
|
|
30
|
+
value = valueOrUndefined;
|
|
31
|
+
}
|
|
23
32
|
this.delegates.forEach(f => { f(sender, value); });
|
|
24
33
|
}
|
|
25
34
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// This library doesn't depend on @types/node (to stay browser-compatible),
|
|
2
|
+
// so this Node.js built-in import can't be type-checked; the exported
|
|
3
|
+
// functions below still declare their own types for callers to rely on.
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
6
|
+
// byte[] is represented as a plain JS/TS array of numbers, not a typed array
|
|
7
|
+
// (see e.g. BitConverter.ts), so convert the Buffer returned by readFileSync.
|
|
8
|
+
export function readAllBytes(path) {
|
|
9
|
+
return Array.from(readFileSync(path));
|
|
10
|
+
}
|
|
11
|
+
export function readAllLines(path) {
|
|
12
|
+
const lines = readFileSync(path, "utf8").split(/\r\n|\r|\n/);
|
|
13
|
+
if (lines[lines.length - 1] === "") {
|
|
14
|
+
lines.pop();
|
|
15
|
+
}
|
|
16
|
+
return lines;
|
|
17
|
+
}
|
|
18
|
+
export function readAllText(path) {
|
|
19
|
+
return readFileSync(path, "utf8");
|
|
20
|
+
}
|
|
21
|
+
export function writeAllBytes(path, bytes) {
|
|
22
|
+
// Convert back from the plain array representation to a typed array Node's fs accepts.
|
|
23
|
+
writeFileSync(path, Uint8Array.from(bytes));
|
|
24
|
+
}
|
|
25
|
+
export function writeAllLines(path, lines) {
|
|
26
|
+
writeFileSync(path, lines.join("\n"));
|
|
27
|
+
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isArrayLike, Exception, defaultOf, toIterator, compare, structuralHash, equals, disposeSafe, getEnumerator } from "./Util.js";
|
|
2
|
+
import { Record, toString } from "./Types.js";
|
|
2
3
|
import { defaultArg, some, value as value_1 } from "./Option.js";
|
|
3
|
-
import { disposeSafe, isArrayLike, Exception, defaultOf, toIterator, getEnumerator, compare, structuralHash, equals } from "./Util.js";
|
|
4
|
-
import { Record } from "./Types.js";
|
|
5
4
|
import { class_type, record_type, option_type } from "./Reflection.js";
|
|
6
5
|
import { SR_inputSequenceTooLong, SR_inputSequenceEmpty, SR_inputMustBeNonNegative, SR_notEnoughElements, SR_differentLengths, SR_keyNotFoundAlt, SR_indexOutOfBounds, SR_inputWasEmpty } from "./Global.js";
|
|
7
6
|
import { KeyNotFoundException_$ctor_Z721C83C5 } from "./System.Collections.Generic.js";
|
|
@@ -15,7 +14,21 @@ export class FSharpList extends Record {
|
|
|
15
14
|
}
|
|
16
15
|
toString() {
|
|
17
16
|
const xs = this;
|
|
18
|
-
|
|
17
|
+
let result = "[";
|
|
18
|
+
let first = true;
|
|
19
|
+
const enumerator = getEnumerator(xs);
|
|
20
|
+
try {
|
|
21
|
+
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
22
|
+
let x = undefined, matchValue = undefined, s = undefined;
|
|
23
|
+
const x_1 = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
24
|
+
result = ((first ? result : (result + "; ")) + ((x = x_1, (matchValue = x, (typeof matchValue === "string") ? ((s = matchValue, ("\"" + s) + "\"")) : toString(x)))));
|
|
25
|
+
first = false;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
finally {
|
|
29
|
+
disposeSafe(enumerator);
|
|
30
|
+
}
|
|
31
|
+
return result + "]";
|
|
19
32
|
}
|
|
20
33
|
Equals(other) {
|
|
21
34
|
const xs = this;
|
|
@@ -222,7 +235,7 @@ export function FSharpList__get_Head(xs) {
|
|
|
222
235
|
return xs.head;
|
|
223
236
|
}
|
|
224
237
|
else {
|
|
225
|
-
throw new Exception(
|
|
238
|
+
throw new Exception(SR_inputWasEmpty + " (Parameter \'list\')");
|
|
226
239
|
}
|
|
227
240
|
}
|
|
228
241
|
export function FSharpList__get_Tail(xs) {
|
|
@@ -231,7 +244,7 @@ export function FSharpList__get_Tail(xs) {
|
|
|
231
244
|
return value_1(matchValue);
|
|
232
245
|
}
|
|
233
246
|
else {
|
|
234
|
-
throw new Exception(
|
|
247
|
+
throw new Exception(SR_inputWasEmpty + " (Parameter \'list\')");
|
|
235
248
|
}
|
|
236
249
|
}
|
|
237
250
|
export function FSharpList__get_Item_Z524259A4(xs, index) {
|
|
@@ -240,17 +253,18 @@ export function FSharpList__get_Item_Z524259A4(xs, index) {
|
|
|
240
253
|
const i = i_mut, xs_1 = xs_1_mut;
|
|
241
254
|
const matchValue = xs_1.tail;
|
|
242
255
|
if (matchValue != null) {
|
|
256
|
+
const t = value_1(matchValue);
|
|
243
257
|
if (i === index) {
|
|
244
258
|
return xs_1.head;
|
|
245
259
|
}
|
|
246
260
|
else {
|
|
247
261
|
i_mut = (i + 1);
|
|
248
|
-
xs_1_mut =
|
|
262
|
+
xs_1_mut = t;
|
|
249
263
|
continue loop;
|
|
250
264
|
}
|
|
251
265
|
}
|
|
252
266
|
else {
|
|
253
|
-
throw new Exception(
|
|
267
|
+
throw new Exception(SR_indexOutOfBounds + " (Parameter \'index\')");
|
|
254
268
|
}
|
|
255
269
|
break;
|
|
256
270
|
}
|
|
@@ -926,7 +940,7 @@ export function exists2(f_mut, xs_mut, ys_mut) {
|
|
|
926
940
|
continue exists2;
|
|
927
941
|
}
|
|
928
942
|
default:
|
|
929
|
-
throw new Exception(
|
|
943
|
+
throw new Exception(SR_differentLengths + " (Parameter \'list2\')");
|
|
930
944
|
}
|
|
931
945
|
break;
|
|
932
946
|
}
|
|
@@ -1021,7 +1035,7 @@ export function skip(count_mut, xs_mut) {
|
|
|
1021
1035
|
return xs;
|
|
1022
1036
|
}
|
|
1023
1037
|
else if (FSharpList__get_IsEmpty(xs)) {
|
|
1024
|
-
throw new Exception(
|
|
1038
|
+
throw new Exception(SR_notEnoughElements + " (Parameter \'list\')");
|
|
1025
1039
|
}
|
|
1026
1040
|
else {
|
|
1027
1041
|
count_mut = (count - 1);
|
|
@@ -1050,7 +1064,7 @@ export function skipWhile(predicate_mut, xs_mut) {
|
|
|
1050
1064
|
}
|
|
1051
1065
|
export function take(count, xs) {
|
|
1052
1066
|
if (count < 0) {
|
|
1053
|
-
throw new Exception(
|
|
1067
|
+
throw new Exception(SR_inputMustBeNonNegative + " (Parameter \'count\')");
|
|
1054
1068
|
}
|
|
1055
1069
|
const loop = (i_mut, acc_mut, xs_1_mut) => {
|
|
1056
1070
|
loop: while (true) {
|
|
@@ -1060,7 +1074,7 @@ export function take(count, xs) {
|
|
|
1060
1074
|
return acc;
|
|
1061
1075
|
}
|
|
1062
1076
|
else if (FSharpList__get_IsEmpty(xs_1)) {
|
|
1063
|
-
throw new Exception(
|
|
1077
|
+
throw new Exception(SR_notEnoughElements + " (Parameter \'list\')");
|
|
1064
1078
|
}
|
|
1065
1079
|
else {
|
|
1066
1080
|
i_mut = (i - 1);
|
|
@@ -1145,22 +1159,22 @@ export function getSlice(startIndex, endIndex, xs) {
|
|
|
1145
1159
|
}
|
|
1146
1160
|
export function splitAt(index, xs) {
|
|
1147
1161
|
if (index < 0) {
|
|
1148
|
-
throw new Exception(
|
|
1162
|
+
throw new Exception(SR_inputMustBeNonNegative + " (Parameter \'index\')");
|
|
1149
1163
|
}
|
|
1150
1164
|
if (index > FSharpList__get_Length(xs)) {
|
|
1151
|
-
throw new Exception(
|
|
1165
|
+
throw new Exception(SR_notEnoughElements + " (Parameter \'index\')");
|
|
1152
1166
|
}
|
|
1153
1167
|
return [take(index, xs), skip(index, xs)];
|
|
1154
1168
|
}
|
|
1155
1169
|
export function exactlyOne(xs) {
|
|
1156
1170
|
if (FSharpList__get_IsEmpty(xs)) {
|
|
1157
|
-
throw new Exception(
|
|
1171
|
+
throw new Exception(SR_inputSequenceEmpty + " (Parameter \'list\')");
|
|
1158
1172
|
}
|
|
1159
1173
|
else if (FSharpList__get_IsEmpty(FSharpList__get_Tail(xs))) {
|
|
1160
1174
|
return FSharpList__get_Head(xs);
|
|
1161
1175
|
}
|
|
1162
1176
|
else {
|
|
1163
|
-
throw new Exception(
|
|
1177
|
+
throw new Exception(SR_inputSequenceTooLong + " (Parameter \'list\')");
|
|
1164
1178
|
}
|
|
1165
1179
|
}
|
|
1166
1180
|
export function tryExactlyOne(xs) {
|
|
@@ -1200,7 +1214,7 @@ export function insertAt(index, y, xs) {
|
|
|
1200
1214
|
}
|
|
1201
1215
|
}, FSharpList_get_Empty(), xs);
|
|
1202
1216
|
return reverse(isDone ? result : (((i + 1) === index) ? FSharpList_Cons_305B8EAC(y, result) : (() => {
|
|
1203
|
-
throw new Exception(
|
|
1217
|
+
throw new Exception(SR_indexOutOfBounds + " (Parameter \'index\')");
|
|
1204
1218
|
})()));
|
|
1205
1219
|
}
|
|
1206
1220
|
export function insertManyAt(index, ys, xs) {
|
|
@@ -1218,7 +1232,7 @@ export function insertManyAt(index, ys, xs) {
|
|
|
1218
1232
|
}
|
|
1219
1233
|
}, FSharpList_get_Empty(), xs);
|
|
1220
1234
|
return reverse(isDone ? result : (((i + 1) === index) ? append(ys_1, result) : (() => {
|
|
1221
|
-
throw new Exception(
|
|
1235
|
+
throw new Exception(SR_indexOutOfBounds + " (Parameter \'index\')");
|
|
1222
1236
|
})()));
|
|
1223
1237
|
}
|
|
1224
1238
|
export function removeAt(index, xs) {
|
|
@@ -1235,7 +1249,7 @@ export function removeAt(index, xs) {
|
|
|
1235
1249
|
}
|
|
1236
1250
|
}, xs);
|
|
1237
1251
|
if (!isDone) {
|
|
1238
|
-
throw new Exception(
|
|
1252
|
+
throw new Exception(SR_indexOutOfBounds + " (Parameter \'index\')");
|
|
1239
1253
|
}
|
|
1240
1254
|
return ys;
|
|
1241
1255
|
}
|
|
@@ -1263,7 +1277,7 @@ export function removeManyAt(index, count, xs) {
|
|
|
1263
1277
|
}, xs);
|
|
1264
1278
|
const status_1 = (((status === 0) && ((i + 1) === (index + count))) ? 1 : status) | 0;
|
|
1265
1279
|
if (status_1 < 1) {
|
|
1266
|
-
throw new Exception(
|
|
1280
|
+
throw new Exception(SR_indexOutOfBounds + ((" (Parameter \'" + ((status_1 < 0) ? "index" : "count")) + "\')"));
|
|
1267
1281
|
}
|
|
1268
1282
|
return ys;
|
|
1269
1283
|
}
|
|
@@ -1279,7 +1293,7 @@ export function updateAt(index, y, xs) {
|
|
|
1279
1293
|
}
|
|
1280
1294
|
}, xs);
|
|
1281
1295
|
if (!isDone) {
|
|
1282
|
-
throw new Exception(
|
|
1296
|
+
throw new Exception(SR_indexOutOfBounds + " (Parameter \'index\')");
|
|
1283
1297
|
}
|
|
1284
1298
|
return ys;
|
|
1285
1299
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { getPrefix, isValid } from "./Int32.js";
|
|
2
|
+
import { fromString } from "./BigInt.js";
|
|
3
|
+
import { Exception } from "./Util.js";
|
|
4
|
+
function getRange(unsigned, bitsize) {
|
|
5
|
+
switch (bitsize) {
|
|
6
|
+
case 64: return unsigned ?
|
|
7
|
+
[0n, 18446744073709551615n] :
|
|
8
|
+
[-9223372036854775808n, 9223372036854775807n];
|
|
9
|
+
default: throw new Exception("Invalid bit size.");
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export function parse(str, style, unsigned, bitsize, radix) {
|
|
13
|
+
const res = isValid(str, style, radix);
|
|
14
|
+
if (res != null) {
|
|
15
|
+
let v = fromString(getPrefix(res.radix) + res.digits);
|
|
16
|
+
if (res.sign === "-") {
|
|
17
|
+
v = -v;
|
|
18
|
+
}
|
|
19
|
+
const [umin, umax] = getRange(true, bitsize);
|
|
20
|
+
if (!unsigned && res.radix !== 10 && v >= umin && v <= umax) {
|
|
21
|
+
v = BigInt.asIntN(bitsize, v);
|
|
22
|
+
}
|
|
23
|
+
const [min, max] = getRange(unsigned, bitsize);
|
|
24
|
+
if (v >= min && v <= max) {
|
|
25
|
+
return v;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
throw new Exception(`The input string ${str} was not in a correct format.`);
|
|
29
|
+
}
|
|
30
|
+
export function tryParse(str, style, unsigned, bitsize, defValue) {
|
|
31
|
+
try {
|
|
32
|
+
defValue.contents = parse(str, style, unsigned, bitsize);
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
}
|
package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/MailboxProcessor.js
RENAMED
|
@@ -27,7 +27,9 @@ class MailboxQueue {
|
|
|
27
27
|
else {
|
|
28
28
|
delete this.firstAndLast;
|
|
29
29
|
}
|
|
30
|
-
|
|
30
|
+
// Wrap the value so falsy messages (0, false, "", null, undefined/unit)
|
|
31
|
+
// can be distinguished from an empty queue.
|
|
32
|
+
return { value };
|
|
31
33
|
}
|
|
32
34
|
return void 0;
|
|
33
35
|
}
|
|
@@ -41,11 +43,11 @@ export class MailboxProcessor {
|
|
|
41
43
|
}
|
|
42
44
|
function __processEvents($this) {
|
|
43
45
|
if ($this.continuation) {
|
|
44
|
-
const
|
|
45
|
-
if (
|
|
46
|
+
const dequeued = $this.messages.tryGet();
|
|
47
|
+
if (dequeued !== void 0) {
|
|
46
48
|
const cont = $this.continuation;
|
|
47
49
|
delete $this.continuation;
|
|
48
|
-
cont(value);
|
|
50
|
+
cont(dequeued.value);
|
|
49
51
|
}
|
|
50
52
|
}
|
|
51
53
|
}
|
|
@@ -67,15 +69,19 @@ export function post($this, message) {
|
|
|
67
69
|
}
|
|
68
70
|
export function postAndAsyncReply($this, buildMessage) {
|
|
69
71
|
let result;
|
|
72
|
+
// Use an explicit flag because the reply value itself may be undefined
|
|
73
|
+
// (e.g. AsyncReplyChannel<unit>), which must still complete the async.
|
|
74
|
+
let replied = false;
|
|
70
75
|
let continuation;
|
|
71
76
|
function checkCompletion() {
|
|
72
|
-
if (
|
|
77
|
+
if (replied && continuation !== void 0) {
|
|
73
78
|
continuation(result);
|
|
74
79
|
}
|
|
75
80
|
}
|
|
76
81
|
const reply = {
|
|
77
82
|
reply: (res) => {
|
|
78
83
|
result = res;
|
|
84
|
+
replied = true;
|
|
79
85
|
checkCompletion();
|
|
80
86
|
},
|
|
81
87
|
};
|
|
@@ -702,11 +702,15 @@ export function MapTreeModule_foldSectionOpt(comparer, lo, hi, f, m, x) {
|
|
|
702
702
|
return x_3;
|
|
703
703
|
}
|
|
704
704
|
}
|
|
705
|
-
else if ((comparer.Compare(lo, MapTreeLeaf$2__get_Key(m2)) <= 0) && (comparer.Compare(MapTreeLeaf$2__get_Key(m2), hi) <= 0)) {
|
|
706
|
-
return f_1(MapTreeLeaf$2__get_Key(m2), MapTreeLeaf$2__get_Value(m2), x_1);
|
|
707
|
-
}
|
|
708
705
|
else {
|
|
709
|
-
|
|
706
|
+
const cLoKey_1 = comparer.Compare(lo, MapTreeLeaf$2__get_Key(m2)) | 0;
|
|
707
|
+
const cKeyHi_1 = comparer.Compare(MapTreeLeaf$2__get_Key(m2), hi) | 0;
|
|
708
|
+
if ((cLoKey_1 <= 0) && (cKeyHi_1 <= 0)) {
|
|
709
|
+
return f_1(MapTreeLeaf$2__get_Key(m2), MapTreeLeaf$2__get_Value(m2), x_1);
|
|
710
|
+
}
|
|
711
|
+
else {
|
|
712
|
+
return x_1;
|
|
713
|
+
}
|
|
710
714
|
}
|
|
711
715
|
}
|
|
712
716
|
else {
|
|
@@ -272,7 +272,7 @@ export function Dictionary__set_Item_5BDDA1(this$, k, v) {
|
|
|
272
272
|
setItem(getItemFromDict(this$.hashMap, matchValue[1]), matchValue[2], [k, v]);
|
|
273
273
|
}
|
|
274
274
|
else {
|
|
275
|
-
|
|
275
|
+
void (getItemFromDict(this$.hashMap, matchValue[1]).push([k, v]));
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
278
|
else {
|
|
@@ -286,7 +286,7 @@ export function Dictionary__Add_5BDDA1(this$, k, v) {
|
|
|
286
286
|
throw ArgumentException_$ctor_Z721C83C5(format("An item with the same key has already been added. Key: {0}", k));
|
|
287
287
|
}
|
|
288
288
|
else {
|
|
289
|
-
|
|
289
|
+
void (getItemFromDict(this$.hashMap, matchValue[1]).push([k, v]));
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
292
|
else {
|
|
@@ -178,7 +178,7 @@ export function HashSet__Add_2B595(this$, k) {
|
|
|
178
178
|
return false;
|
|
179
179
|
}
|
|
180
180
|
else {
|
|
181
|
-
|
|
181
|
+
void (getItemFromDict(this$.hashMap, matchValue[1]).push(k));
|
|
182
182
|
return true;
|
|
183
183
|
}
|
|
184
184
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Choice_tryValueIfChoice1Of2, Choice_tryValueIfChoice2Of2 } from "./Choice.js";
|
|
2
|
-
import { value } from "./Option.js";
|
|
2
|
+
import { some, value } from "./Option.js";
|
|
3
3
|
export class Observer {
|
|
4
4
|
constructor(onNext, onError, onCompleted) {
|
|
5
5
|
this.OnNext = onNext;
|
|
@@ -29,7 +29,7 @@ export function choose(chooser, source) {
|
|
|
29
29
|
} }, observer.OnError), observer.OnError, observer.OnCompleted)));
|
|
30
30
|
}
|
|
31
31
|
export function filter(predicate, source) {
|
|
32
|
-
return choose((x) => predicate(x) ? x :
|
|
32
|
+
return choose((x) => predicate(x) ? some(x) : undefined, source);
|
|
33
33
|
}
|
|
34
34
|
export function map(mapping, source) {
|
|
35
35
|
return new Observable((observer) => source.Subscribe(new Observer((t) => {
|
|
@@ -84,11 +84,13 @@ export function merge(source1, source2) {
|
|
|
84
84
|
export function pairwise(source) {
|
|
85
85
|
return new Observable((observer) => {
|
|
86
86
|
let last;
|
|
87
|
+
let haveLast = false;
|
|
87
88
|
return source.Subscribe(new Observer((next) => {
|
|
88
|
-
if (
|
|
89
|
+
if (haveLast) {
|
|
89
90
|
observer.OnNext([last, next]);
|
|
90
91
|
}
|
|
91
92
|
last = next;
|
|
93
|
+
haveLast = true;
|
|
92
94
|
}, observer.OnError, observer.OnCompleted));
|
|
93
95
|
});
|
|
94
96
|
}
|
|
@@ -70,30 +70,13 @@ export function toArray(opt) {
|
|
|
70
70
|
export function defaultArg(opt, defaultValue) {
|
|
71
71
|
return (opt != null) ? value(opt) : defaultValue;
|
|
72
72
|
}
|
|
73
|
-
export function defaultArgWith(opt, defThunk) {
|
|
74
|
-
return (opt != null) ? value(opt) : defThunk();
|
|
75
|
-
}
|
|
76
73
|
export function orElse(opt, ifNone) {
|
|
77
74
|
return opt == null ? ifNone : opt;
|
|
78
75
|
}
|
|
79
|
-
|
|
80
|
-
return opt == null ? ifNoneThunk() : opt;
|
|
81
|
-
}
|
|
82
|
-
export function filter(predicate, opt) {
|
|
83
|
-
return (opt != null) ? (predicate(value(opt)) ? opt : undefined) : opt;
|
|
84
|
-
}
|
|
76
|
+
// Only used by Replacements.Util.fs's curry/uncurry helpers, not by `Option.map` itself.
|
|
85
77
|
export function map(mapping, opt) {
|
|
86
78
|
return (opt != null) ? some(mapping(value(opt))) : undefined;
|
|
87
79
|
}
|
|
88
|
-
export function map2(mapping, opt1, opt2) {
|
|
89
|
-
return (opt1 != null && opt2 != null) ? mapping(value(opt1), value(opt2)) : undefined;
|
|
90
|
-
}
|
|
91
|
-
export function map3(mapping, opt1, opt2, opt3) {
|
|
92
|
-
return (opt1 != null && opt2 != null && opt3 != null) ? mapping(value(opt1), value(opt2), value(opt3)) : undefined;
|
|
93
|
-
}
|
|
94
|
-
export function bind(binder, opt) {
|
|
95
|
-
return opt != null ? binder(value(opt)) : undefined;
|
|
96
|
-
}
|
|
97
80
|
export function tryOp(op, arg) {
|
|
98
81
|
try {
|
|
99
82
|
return some(op(arg));
|