1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

Fix remaining linting errors, from enabling the prefer-const ESLint rule globally

This covers cases that the `--fix` command couldn't deal with, and in a few cases (notably `src/core/jbig2.js`) the code was changed to use block-scoped variables instead.
This commit is contained in:
Jonas Jenwald 2020-01-24 13:21:16 +01:00
parent 9e262ae7fa
commit 83bdb525a4
10 changed files with 76 additions and 109 deletions

View file

@ -2284,8 +2284,8 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
baseDict,
properties
) {
let xref = this.xref,
cidToGidBytes;
const xref = this.xref;
let cidToGidBytes;
// 9.10.2
var toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode");
var toUnicodePromise = toUnicode
@ -2413,15 +2413,13 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
_buildSimpleFontToUnicode(properties, forceGlyphs = false) {
assert(!properties.composite, "Must be a simple font.");
let toUnicode = [],
charcode,
glyphName;
const toUnicode = [];
const encoding = properties.defaultEncoding.slice();
const baseEncodingName = properties.baseEncodingName;
// Merge in the differences array.
const differences = properties.differences;
for (charcode in differences) {
glyphName = differences[charcode];
for (const charcode in differences) {
const glyphName = differences[charcode];
if (glyphName === ".notdef") {
// Skip .notdef to prevent rendering errors, e.g. boxes appearing
// where there should be spaces (fixes issue5256.pdf).
@ -2430,9 +2428,9 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
encoding[charcode] = glyphName;
}
const glyphsUnicodeMap = getGlyphsUnicode();
for (charcode in encoding) {
for (const charcode in encoding) {
// a) Map the character code to a character name.
glyphName = encoding[charcode];
let glyphName = encoding[charcode];
// b) Look up the character name in the Adobe Glyph List (see the
// Bibliography) to obtain the corresponding Unicode value.
if (glyphName === "") {