1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 14:48:08 +02:00

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;
}
function setValues(arr, start, end, value) {
for (let j = start; j < end; ++j) {
arr[j] = value;
}
}
function reverseValues(arr, start, end) {
for (let i = start, j = end - 1; i < j; ++i, --j) {
const temp = arr[i];
@ -323,7 +317,7 @@ function bidi(str, startLevel = -1, vertical = false) {
after = "R";
}
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)
}