@fable-org/fable-library-js 2.0.0-beta.6 → 2.0.0-beta.7

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,10 @@ 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.7 - 2026-02-03
11
+
12
+ * [JS/TS] Fix `StringBuilder.Chars` getter and setter (by @MangelMaxime)
13
+
10
14
  ## 2.0.0-beta.6 - 2025-12-26
11
15
 
12
16
  ### Fixed
package/System.Text.js CHANGED
@@ -117,31 +117,31 @@ export function StringBuilder__Clear(x) {
117
117
  }
118
118
  export function StringBuilder__get_Chars_Z524259A4(x, index) {
119
119
  let len = 0;
120
- let i = -1;
121
- while (((i + 1) < x.buf.length) && (len < index)) {
122
- i = ((i + 1) | 0);
120
+ let i = 0;
121
+ while ((i < x.buf.length) && ((len + x.buf[i].length) <= index)) {
123
122
  len = ((len + x.buf[i].length) | 0);
123
+ i = ((i + 1) | 0);
124
124
  }
125
- if (((index < 0) ? true : (i < 0)) ? true : (i >= x.buf.length)) {
125
+ if ((index < 0) ? true : (i >= x.buf.length)) {
126
126
  throw new Exception("Index was outside the bounds of the array");
127
127
  }
128
128
  else {
129
- const pos = ((len - index) - 1) | 0;
129
+ const pos = (index - len) | 0;
130
130
  return x.buf[i][pos];
131
131
  }
132
132
  }
133
133
  export function StringBuilder__set_Chars_413E0D0A(x, index, value) {
134
134
  let len = 0;
135
- let i = -1;
136
- while (((i + 1) < x.buf.length) && (len < index)) {
137
- i = ((i + 1) | 0);
135
+ let i = 0;
136
+ while ((i < x.buf.length) && ((len + x.buf[i].length) <= index)) {
138
137
  len = ((len + x.buf[i].length) | 0);
138
+ i = ((i + 1) | 0);
139
139
  }
140
- if (((index < 0) ? true : (i < 0)) ? true : (i >= x.buf.length)) {
140
+ if ((index < 0) ? true : (i >= x.buf.length)) {
141
141
  throw new Exception("Index was outside the bounds of the array");
142
142
  }
143
143
  else {
144
- const pos = ((len - index) - 1) | 0;
144
+ const pos = (index - len) | 0;
145
145
  x.buf[i] = ((x.buf[i].slice(0, (pos - 1) + 1) + value) + x.buf[i].slice(pos + 1, x.buf[i].length));
146
146
  }
147
147
  }
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.0.0-beta.6",
6
+ "version": "2.0.0-beta.7",
7
7
  "description": "Core library used by F# projects compiled with fable.io",
8
8
  "author": "Fable Contributors",
9
9
  "license": "MIT",