1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

Use String.prototype.replaceAll() where appropriate

This fairly new method allows replacing *multiple* occurrences within a string without having to use regular expressions.

Please refer to:
 - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll
 - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll#browser_compatibility
This commit is contained in:
Jonas Jenwald 2023-03-22 15:31:10 +01:00
parent 076bb30b6c
commit 5f64621d46
10 changed files with 15 additions and 15 deletions

View file

@ -157,9 +157,10 @@ describe("ui_utils", function () {
});
it("should modify string with non-displayable characters", function () {
const str = Array.from(Array(32).keys())
.map(x => String.fromCharCode(x) + "a")
.join("");
const str = Array.from(
Array(32).keys(),
x => String.fromCharCode(x) + "a"
).join("");
// \x00 is replaced by an empty string.
const expected =
"a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a";