@fable-org/fable-library-js 2.5.0 → 2.5.1

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
@@ -1,7 +1,7 @@
1
1
  import { disposeSafe, getEnumerator, copyToArray, defaultOf, Exception } from "./Util.js";
2
2
  import { Helpers_allocateArrayFromCons } from "./Native.js";
3
3
  import { setItem as setItem_1, item as item_2 } from "./Array.js";
4
- import { value as value_2, map as map_1, defaultArg, some } from "./Option.js";
4
+ import { value as value_2, defaultArg, some } from "./Option.js";
5
5
  import { min as min_1, max as max_1 } from "./Double.js";
6
6
  import { SR_notEnoughElements, SR_inputMustBeNonNegative, SR_inputSequenceEmpty, SR_Arg_ArgumentOutOfRangeException, SR_indexOutOfBounds } from "./Global.js";
7
7
  import { Operators_IsNull } from "./FSharp.Core.js";
@@ -183,8 +183,9 @@ export function where(predicate, array) {
183
183
  return array.filter(predicate);
184
184
  }
185
185
  export function indexOf(array, item_1, start, count, eq) {
186
+ let option_1 = undefined;
186
187
  const start_1 = defaultArg(start, 0) | 0;
187
- const end$0027 = defaultArg(map_1((c) => ((start_1 + c) | 0), count), array.length) | 0;
188
+ const end$0027 = defaultArg((option_1 = count, (option_1 != null) ? (start_1 + value_2(option_1)) : undefined), array.length) | 0;
188
189
  const loop = (i_mut) => {
189
190
  loop: while (true) {
190
191
  const i = i_mut;
package/CHANGELOG.md CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
- last_commit_released: 6568f35ece227fc30ce84111c8d2e975b09bac00
2
+ last_commit_released: 619d7afddbaf25108e819abaaa9d8a6503c457d6
3
3
  updaters:
4
4
  - package.json:
5
5
  file: package.json
@@ -15,6 +15,14 @@ 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
+
18
26
  ## 2.5.0 - 2026-07-15
19
27
 
20
28
  ### 🚀 Features
package/List.js CHANGED
@@ -253,12 +253,13 @@ export function FSharpList__get_Item_Z524259A4(xs, index) {
253
253
  const i = i_mut, xs_1 = xs_1_mut;
254
254
  const matchValue = xs_1.tail;
255
255
  if (matchValue != null) {
256
+ const t = value_1(matchValue);
256
257
  if (i === index) {
257
258
  return xs_1.head;
258
259
  }
259
260
  else {
260
261
  i_mut = (i + 1);
261
- xs_1_mut = value_1(matchValue);
262
+ xs_1_mut = t;
262
263
  continue loop;
263
264
  }
264
265
  }
package/Map.js CHANGED
@@ -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
- return x_1;
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 {
package/MutableMap.js CHANGED
@@ -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
- const value = void (getItemFromDict(this$.hashMap, matchValue[1]).push([k, v]));
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
- const value = void (getItemFromDict(this$.hashMap, matchValue[1]).push([k, v]));
289
+ void (getItemFromDict(this$.hashMap, matchValue[1]).push([k, v]));
290
290
  }
291
291
  }
292
292
  else {
package/MutableSet.js CHANGED
@@ -178,7 +178,7 @@ export function HashSet__Add_2B595(this$, k) {
178
178
  return false;
179
179
  }
180
180
  else {
181
- const value = void (getItemFromDict(this$.hashMap, matchValue[1]).push(k));
181
+ void (getItemFromDict(this$.hashMap, matchValue[1]).push(k));
182
182
  return true;
183
183
  }
184
184
  }
package/Option.js CHANGED
@@ -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
- export function orElseWith(opt, ifNoneThunk) {
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));
package/Seq.js CHANGED
@@ -277,7 +277,7 @@ export function Enumerator_unfold(f, state) {
277
277
  return Enumerator_FromFunctions$1_$ctor_58C54629(() => {
278
278
  if (curr != null) {
279
279
  const x = value_1(curr)[0];
280
- const st = value_1(curr)[1];
280
+ value_1(curr)[1];
281
281
  return x;
282
282
  }
283
283
  else {
@@ -286,7 +286,7 @@ export function Enumerator_unfold(f, state) {
286
286
  }, () => {
287
287
  curr = f(acc);
288
288
  if (curr != null) {
289
- const x_1 = value_1(curr)[0];
289
+ value_1(curr)[0];
290
290
  const st_1 = value_1(curr)[1];
291
291
  acc = st_1;
292
292
  return true;
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": "2.5.0",
6
+ "version": "2.5.1",
7
7
  "description": "Core library used by F# projects compiled with fable.io",
8
8
  "author": "Fable Contributors",
9
9
  "license": "MIT",