Merge pull request #19703 from Snuffleupagus/bidi-rm-setValues

Replace the `setValues` function with `Array.prototype.fill()` in the `src/core/bidi.js` file
This commit is contained in:
Tim van der Meij 2025-03-22 13:13:42 +01:00 committed by GitHub
commit 7f70835830
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -91,12 +91,6 @@ function findUnequal(arr, start, value) {
return j; return j;
} }
function setValues(arr, start, end, value) {
for (let j = start; j < end; ++j) {
arr[j] = value;
}
}
function reverseValues(arr, start, end) { function reverseValues(arr, start, end) {
for (let i = start, j = end - 1; i < j; ++i, --j) { for (let i = start, j = end - 1; i < j; ++i, --j) {
const temp = arr[i]; const temp = arr[i];
@ -323,7 +317,7 @@ function bidi(str, startLevel = -1, vertical = false) {
after = "R"; after = "R";
} }
if (before === after) { if (before === after) {
setValues(types, i, end, before); types.fill(before, i, end);
} }
i = end - 1; // reset to end (-1 so next iteration is ok) i = end - 1; // reset to end (-1 so next iteration is ok)
} }