mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-29 15:47:57 +02:00
Enable the no-else-return
ESLint rule
Using `else` after `return` is not necessary, and can often lead to unnecessarily cluttered code. By using the `no-else-return` rule in ESLint we can avoid this pattern, see http://eslint.org/docs/rules/no-else-return.
This commit is contained in:
parent
049d7fa277
commit
4046d67fde
19 changed files with 67 additions and 79 deletions
|
@ -399,22 +399,21 @@ var PDFFindController = (function PDFFindControllerClosure() {
|
|||
offset.matchIdx = (previous ? numMatches - 1 : 0);
|
||||
this.updateMatch(true);
|
||||
return true;
|
||||
} else {
|
||||
// No matches, so attempt to search the next page.
|
||||
this.advanceOffsetPage(previous);
|
||||
if (offset.wrapped) {
|
||||
offset.matchIdx = null;
|
||||
if (this.pagesToSearch < 0) {
|
||||
// No point in wrapping again, there were no matches.
|
||||
this.updateMatch(false);
|
||||
// while matches were not found, searching for a page
|
||||
// with matches should nevertheless halt.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// Matches were not found (and searching is not done).
|
||||
return false;
|
||||
}
|
||||
// No matches, so attempt to search the next page.
|
||||
this.advanceOffsetPage(previous);
|
||||
if (offset.wrapped) {
|
||||
offset.matchIdx = null;
|
||||
if (this.pagesToSearch < 0) {
|
||||
// No point in wrapping again, there were no matches.
|
||||
this.updateMatch(false);
|
||||
// while matches were not found, searching for a page
|
||||
// with matches should nevertheless halt.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// Matches were not found (and searching is not done).
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue