mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-12 01:55:48 +02:00
Merge pull request #21554 from Snuffleupagus/more-startsWith
Replace a couple of `indexOf` calls with `startsWith`
This commit is contained in:
commit
c4574a5470
13
external/builder/builder.mjs
vendored
13
external/builder/builder.mjs
vendored
@ -113,16 +113,9 @@ function preprocess(inFilename, outFilename, defines) {
|
||||
const realPath = fs.realpathSync(inFilename);
|
||||
const dir = path.dirname(realPath);
|
||||
try {
|
||||
let fullpath;
|
||||
if (file.indexOf("$ROOT/") === 0) {
|
||||
fullpath = path.join(
|
||||
__dirname,
|
||||
"../..",
|
||||
file.substring("$ROOT/".length)
|
||||
);
|
||||
} else {
|
||||
fullpath = path.join(dir, file);
|
||||
}
|
||||
const fullpath = file.startsWith("$ROOT/")
|
||||
? path.join(__dirname, "../..", file.substring("$ROOT/".length))
|
||||
: path.join(dir, file);
|
||||
preprocess(fullpath, writeLine, defines);
|
||||
} catch (e) {
|
||||
if (e.code === "ENOENT") {
|
||||
|
||||
2
external/cmapscompress/compress.mjs
vendored
2
external/cmapscompress/compress.mjs
vendored
@ -386,7 +386,7 @@ function writeNumber(n) {
|
||||
if (buffer > 0) {
|
||||
s = writeByte((buffer & 0x7f) | (s.length > 0 ? 0x80 : 0)) + s;
|
||||
}
|
||||
while (s.indexOf("80") === 0) {
|
||||
while (s.startsWith("80")) {
|
||||
s = s.substring(2);
|
||||
}
|
||||
return s;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user