mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Enable the unicorn/prefer-array-flat
and unicorn/prefer-array-flat-map
ESLint plugin rules
These rules will help enforce shorter and more readable code, and according to MDN these Array-methods are available in all browsers/environments that we currently support: - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat#browser_compatibility - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flatMap#browser_compatibility Please find additional information about these ESLint rules here: - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-flat.md - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-flat-map.md
This commit is contained in:
parent
a57a4bc6c2
commit
010d996b74
2 changed files with 3 additions and 1 deletions
|
@ -254,7 +254,7 @@ function searchNode(
|
|||
if (isFinite(index)) {
|
||||
root = nodes.filter(node => index < node.length).map(node => node[index]);
|
||||
} else {
|
||||
root = nodes.reduce((acc, node) => acc.concat(node), []);
|
||||
root = nodes.flat();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue