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

Enable the unicorn/prefer-logical-operator-over-ternary ESLint plugin rule

This leads to ever so slightly more compact code, and can in some cases remove the need for a temporary variable.

Please find additional information here:
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-logical-operator-over-ternary.md
This commit is contained in:
Jonas Jenwald 2022-07-12 10:52:37 +02:00
parent aa6512e70f
commit dcc73423e5
5 changed files with 13 additions and 15 deletions

View file

@ -35,9 +35,8 @@ const Name = (function NameClosure() {
}
static get(name) {
const nameValue = nameCache[name];
// eslint-disable-next-line no-restricted-syntax
return nameValue ? nameValue : (nameCache[name] = new Name(name));
return nameCache[name] || (nameCache[name] = new Name(name));
}
static _clearCache() {
@ -65,9 +64,8 @@ const Cmd = (function CmdClosure() {
}
static get(cmd) {
const cmdValue = cmdCache[cmd];
// eslint-disable-next-line no-restricted-syntax
return cmdValue ? cmdValue : (cmdCache[cmd] = new Cmd(cmd));
return cmdCache[cmd] || (cmdCache[cmd] = new Cmd(cmd));
}
static _clearCache() {
@ -310,9 +308,8 @@ const Ref = (function RefClosure() {
static get(num, gen) {
const key = gen === 0 ? `${num}R` : `${num}R${gen}`;
const refValue = refCache[key];
// eslint-disable-next-line no-restricted-syntax
return refValue ? refValue : (refCache[key] = new Ref(num, gen));
return refCache[key] || (refCache[key] = new Ref(num, gen));
}
static _clearCache() {