@fable-org/fable-library-ts 1.7.0 → 1.8.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/CHANGELOG.md CHANGED
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## Unreleased
9
9
 
10
+ ## 1.8.0 - 2024-11-19
11
+
12
+ * [JS/TS] Fix `h` in `DateTime.ToString` (@MangelMaxime)
13
+ * [JS/TS] Fix `hh` in `DateTime.ToString` (@MangelMaxime)
14
+
10
15
  ## 1.7.0 - 2024-11-19
11
16
 
12
17
  ### Fixed
package/Choice.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Union } from "./Types.js";
2
2
  import { union_type, TypeInfo } from "./Reflection.js";
3
+ import { int32 } from "./Int32.js";
3
4
  import { Option, some } from "./Option.js";
4
5
 
5
6
  export type FSharpChoice$2_$union<T1, T2> =
@@ -281,8 +282,8 @@ export function Choice_makeChoice2Of2<T2, a>(x: T2): FSharpChoice$2_$union<a, T2
281
282
  }
282
283
 
283
284
  export function Choice_tryValueIfChoice1Of2<T1, T2>(x: FSharpChoice$2_$union<T1, T2>): Option<T1> {
284
- if (x.tag === /* Choice1Of2 */ 0) {
285
- return some(x.fields[0]);
285
+ if ((x.tag as int32) === /* Choice1Of2 */ 0) {
286
+ return some(x.fields[0] as any);
286
287
  }
287
288
  else {
288
289
  return undefined;
@@ -290,8 +291,8 @@ export function Choice_tryValueIfChoice1Of2<T1, T2>(x: FSharpChoice$2_$union<T1,
290
291
  }
291
292
 
292
293
  export function Choice_tryValueIfChoice2Of2<T1, T2>(x: FSharpChoice$2_$union<T1, T2>): Option<T2> {
293
- if (x.tag === /* Choice2Of2 */ 1) {
294
- return some(x.fields[0]);
294
+ if ((x.tag as int32) === /* Choice2Of2 */ 1) {
295
+ return some(x.fields[0] as any);
295
296
  }
296
297
  else {
297
298
  return undefined;
package/Date.ts CHANGED
@@ -166,10 +166,12 @@ function dateToStringWithCustomFormat(date: Date, format: string, utc: boolean)
166
166
  cursorPos += tokenLength;
167
167
  switch (tokenLength) {
168
168
  case 1:
169
- result += hour(localizedDate) % 12
169
+ const h1Value = hour(localizedDate) % 12;
170
+ result += h1Value ? h1Value : 12;
170
171
  break;
171
172
  case 2:
172
- result += padWithZeros(hour(localizedDate) % 12, 2);
173
+ const h2Value = hour(localizedDate) % 12;
174
+ result += padWithZeros(h2Value ? h2Value : 12, 2);
173
175
  break;
174
176
  default:
175
177
  break;
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 { equals } from "./Util.js";
4
3
  import { int32 } from "./Int32.js";
4
+ import { equals } from "./Util.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 (result.tag === /* Ok */ 0) {
40
- return FSharpResult$2_Ok<b, c>(mapping(result.fields[0]));
39
+ if ((result.tag as int32) === /* Ok */ 0) {
40
+ return FSharpResult$2_Ok<b, c>(mapping(result.fields[0] as any));
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] as any);
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 (result.tag === /* Ok */ 0) {
49
- return FSharpResult$2_Ok<c, b>(result.fields[0]);
48
+ if ((result.tag as int32) === /* Ok */ 0) {
49
+ return FSharpResult$2_Ok<c, b>(result.fields[0] as any);
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] as any));
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 (result.tag === /* Ok */ 0) {
58
- return binder(result.fields[0]);
57
+ if ((result.tag as int32) === /* Ok */ 0) {
58
+ return binder(result.fields[0] as any);
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] as any);
62
62
  }
63
63
  }
64
64
 
65
65
  export function Result_IsOk<a, b>(result: FSharpResult$2_$union<a, b>): boolean {
66
- if (result.tag === /* Ok */ 0) {
66
+ if ((result.tag as int32) === /* 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 (result.tag === /* Ok */ 0) {
75
+ if ((result.tag as int32) === /* 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 (result.tag === /* Ok */ 0) {
85
- return equals(result.fields[0], value);
84
+ if ((result.tag as int32) === /* Ok */ 0) {
85
+ return equals(result.fields[0] as any, 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 (result.tag === /* Ok */ 0) {
93
+ if ((result.tag as int32) === /* 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 (result.tag === /* Ok */ 0) {
103
- return result.fields[0];
102
+ if ((result.tag as int32) === /* Ok */ 0) {
103
+ return result.fields[0] as any;
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 (result.tag === /* Ok */ 0) {
112
- return result.fields[0];
111
+ if ((result.tag as int32) === /* Ok */ 0) {
112
+ return result.fields[0] as any;
113
113
  }
114
114
  else {
115
- return defThunk(result.fields[0]);
115
+ return defThunk(result.fields[0] as any);
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 (result.tag === /* Ok */ 0) {
121
- return predicate(result.fields[0]);
120
+ if ((result.tag as int32) === /* Ok */ 0) {
121
+ return predicate(result.fields[0] as any);
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 (result.tag === /* Ok */ 0) {
130
- return folder(state, result.fields[0]);
129
+ if ((result.tag as int32) === /* Ok */ 0) {
130
+ return folder(state, result.fields[0] as any);
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 (result.tag === /* Ok */ 0) {
139
- return folder(result.fields[0], state);
138
+ if ((result.tag as int32) === /* Ok */ 0) {
139
+ return folder(result.fields[0] as any, 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 (result.tag === /* Ok */ 0) {
148
- return predicate(result.fields[0]);
147
+ if ((result.tag as int32) === /* Ok */ 0) {
148
+ return predicate(result.fields[0] as any);
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 (result.tag === /* Ok */ 0) {
157
- action(result.fields[0]);
156
+ if ((result.tag as int32) === /* Ok */ 0) {
157
+ action(result.fields[0] as any);
158
158
  }
159
159
  }
160
160
 
161
161
  export function Result_ToArray<a, b>(result: FSharpResult$2_$union<a, b>): a[] {
162
- if (result.tag === /* Ok */ 0) {
163
- return [result.fields[0]];
162
+ if ((result.tag as int32) === /* Ok */ 0) {
163
+ return [result.fields[0] as any];
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 (result.tag === /* Ok */ 0) {
172
- return singleton(result.fields[0]);
171
+ if ((result.tag as int32) === /* Ok */ 0) {
172
+ return singleton(result.fields[0] as any);
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 (result.tag === /* Ok */ 0) {
181
- return some(result.fields[0]);
180
+ if ((result.tag as int32) === /* Ok */ 0) {
181
+ return some(result.fields[0] as any);
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 (result.tag === /* Ok */ 0) {
190
- return some(result.fields[0]);
189
+ if ((result.tag as int32) === /* Ok */ 0) {
190
+ return some(result.fields[0] as any);
191
191
  }
192
192
  else {
193
193
  return undefined;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "private": false,
4
4
  "type": "module",
5
5
  "name": "@fable-org/fable-library-ts",
6
- "version": "1.7.0",
6
+ "version": "1.8.0",
7
7
  "description": "Core library used by F# projects compiled with fable.io",
8
8
  "author": "Fable Contributors",
9
9
  "license": "MIT",