Use const rather than let where possible

This commit is contained in:
toasted-nutbread 2019-11-25 14:28:52 -05:00
parent 527595f79b
commit ef833d2bea
5 changed files with 6 additions and 6 deletions

View File

@ -89,7 +89,7 @@ function handlebarsRegexReplace(...args) {
let value = args[args.length - 1].fn(this); let value = args[args.length - 1].fn(this);
if (args.length >= 3) { if (args.length >= 3) {
try { try {
let flags = args.length > 3 ? args[2] : 'g'; const flags = args.length > 3 ? args[2] : 'g';
const regex = new RegExp(args[0], flags); const regex = new RegExp(args[0], flags);
value = value.replace(regex, args[1]); value = value.replace(regex, args[1]);
} catch (e) { } catch (e) {

View File

@ -134,7 +134,7 @@ class QueryParser {
}); });
} }
if (this.search.options.parsing.enableMecabParser) { if (this.search.options.parsing.enableMecabParser) {
let mecabResults = await apiTextParseMecab(text, this.search.getOptionsContext()); const mecabResults = await apiTextParseMecab(text, this.search.getOptionsContext());
for (const mecabDictName in mecabResults) { for (const mecabDictName in mecabResults) {
results.push({ results.push({
name: `MeCab: ${mecabDictName}`, name: `MeCab: ${mecabDictName}`,

View File

@ -356,7 +356,7 @@ class DisplaySearch extends Display {
} }
static getSearchQueryFromLocation(url) { static getSearchQueryFromLocation(url) {
let match = /^[^?#]*\?(?:[^&#]*&)?query=([^&#]*)/.exec(url); const match = /^[^?#]*\?(?:[^&#]*&)?query=([^&#]*)/.exec(url);
return match !== null ? decodeURIComponent(match[1]) : null; return match !== null ? decodeURIComponent(match[1]) : null;
} }
} }

View File

@ -447,8 +447,8 @@ class Frontend {
} }
getIndexOfTouch(touchList, identifier) { getIndexOfTouch(touchList, identifier) {
for (let i in touchList) { for (const i in touchList) {
let t = touchList[i]; const t = touchList[i];
if (t.identifier === identifier) { if (t.identifier === identifier) {
return i; return i;
} }

View File

@ -361,7 +361,7 @@ class TextSourceElement {
let consumed = 0; let consumed = 0;
let content = ''; let content = '';
for (let currentChar of this.content || '') { for (const currentChar of this.content || '') {
if (consumed >= length) { if (consumed >= length) {
break; break;
} else if (!currentChar.match(IGNORE_TEXT_PATTERN)) { } else if (!currentChar.match(IGNORE_TEXT_PATTERN)) {