mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Use String.prototype.repeat()
in a couple of spots
Rather than using a temporary Array to manually create repeated strings, we can use `String.prototype.repeat()` instead. The reason that we didn't use this from the start is most likely because some browsers, notably IE, didn't support this; note https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat#browser_compatibility
This commit is contained in:
parent
d6592b5e37
commit
addb4cb12b
3 changed files with 5 additions and 11 deletions
|
@ -717,11 +717,7 @@ class Catalog {
|
|||
const character = String.fromCharCode(
|
||||
baseCharCode + (letterIndex % LIMIT)
|
||||
);
|
||||
const charBuf = [];
|
||||
for (let j = 0, jj = (letterIndex / LIMIT) | 0; j <= jj; j++) {
|
||||
charBuf.push(character);
|
||||
}
|
||||
currentLabel = charBuf.join("");
|
||||
currentLabel = character.repeat(Math.floor(letterIndex / LIMIT) + 1);
|
||||
break;
|
||||
default:
|
||||
if (style) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue