mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-24 09:08:07 +02:00
Use arrow function with various Array methods
A lot of this is quite old code, which we can shorten slightly by using arrow functions instead of "regular" functions.
This commit is contained in:
parent
7081a1f112
commit
2e62f426fe
10 changed files with 16 additions and 46 deletions
|
@ -49,10 +49,7 @@ async function initializePDFJS(callback) {
|
|||
"pdfjs-test/font/font_os2_spec.js",
|
||||
"pdfjs-test/font/font_post_spec.js",
|
||||
"pdfjs-test/font/font_fpgm_spec.js",
|
||||
].map(function (moduleName) {
|
||||
// eslint-disable-next-line no-unsanitized/method
|
||||
return import(moduleName);
|
||||
})
|
||||
].map(moduleName => import(moduleName)) // eslint-disable-line no-unsanitized/method
|
||||
);
|
||||
|
||||
callback();
|
||||
|
|
|
@ -64,9 +64,7 @@ function flatten(stats) {
|
|||
});
|
||||
// Use only overall results if not grouped by 'stat'
|
||||
if (!options.groupBy.includes("stat")) {
|
||||
rows = rows.filter(function (s) {
|
||||
return s.stat === "Overall";
|
||||
});
|
||||
rows = rows.filter(s => s.stat === "Overall");
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
@ -129,9 +127,7 @@ function stat(baseline, current) {
|
|||
}
|
||||
const rows = [];
|
||||
// collect rows and measure column widths
|
||||
const width = labels.map(function (s) {
|
||||
return s.length;
|
||||
});
|
||||
const width = labels.map(s => s.length);
|
||||
rows.push(labels);
|
||||
for (const key of keys) {
|
||||
const baselineMean = mean(baselineGroup[key]);
|
||||
|
@ -162,9 +158,7 @@ function stat(baseline, current) {
|
|||
}
|
||||
|
||||
// add horizontal line
|
||||
const hline = width.map(function (w) {
|
||||
return new Array(w + 1).join("-");
|
||||
});
|
||||
const hline = width.map(w => new Array(w + 1).join("-"));
|
||||
rows.splice(1, 0, hline);
|
||||
|
||||
// print output
|
||||
|
|
|
@ -1051,9 +1051,7 @@ async function closeSession(browser) {
|
|||
await session.browser.close();
|
||||
}
|
||||
session.closed = true;
|
||||
const allClosed = sessions.every(function (s) {
|
||||
return s.closed;
|
||||
});
|
||||
const allClosed = sessions.every(s => s.closed);
|
||||
if (allClosed) {
|
||||
if (tempDir) {
|
||||
fs.rmSync(tempDir, { recursive: true, force: true });
|
||||
|
|
|
@ -4869,9 +4869,9 @@ Caron Broadcasting, Inc., an Ohio corporation (“Lessee”).`)
|
|||
// Issue 6205 reported an issue with font rendering, so clear the loaded
|
||||
// fonts so that we can see whether loading PDFs in parallel does not
|
||||
// cause any issues with the rendered fonts.
|
||||
const destroyPromises = loadingTasks.map(function (loadingTask) {
|
||||
return loadingTask.destroy();
|
||||
});
|
||||
const destroyPromises = loadingTasks.map(loadingTask =>
|
||||
loadingTask.destroy()
|
||||
);
|
||||
await Promise.all(destroyPromises);
|
||||
});
|
||||
|
||||
|
|
|
@ -100,10 +100,7 @@ async function initializePDFJS(callback) {
|
|||
"pdfjs-test/unit/xfa_serialize_data_spec.js",
|
||||
"pdfjs-test/unit/xfa_tohtml_spec.js",
|
||||
"pdfjs-test/unit/xml_spec.js",
|
||||
].map(function (moduleName) {
|
||||
// eslint-disable-next-line no-unsanitized/method
|
||||
return import(moduleName);
|
||||
})
|
||||
].map(moduleName => import(moduleName)) // eslint-disable-line no-unsanitized/method
|
||||
);
|
||||
|
||||
if (isNodeJS) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue