Use const rather than let where possible
This commit is contained in:
parent
527595f79b
commit
ef833d2bea
@ -89,7 +89,7 @@ function handlebarsRegexReplace(...args) {
|
||||
let value = args[args.length - 1].fn(this);
|
||||
if (args.length >= 3) {
|
||||
try {
|
||||
let flags = args.length > 3 ? args[2] : 'g';
|
||||
const flags = args.length > 3 ? args[2] : 'g';
|
||||
const regex = new RegExp(args[0], flags);
|
||||
value = value.replace(regex, args[1]);
|
||||
} catch (e) {
|
||||
|
@ -134,7 +134,7 @@ class QueryParser {
|
||||
});
|
||||
}
|
||||
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) {
|
||||
results.push({
|
||||
name: `MeCab: ${mecabDictName}`,
|
||||
|
@ -356,7 +356,7 @@ class DisplaySearch extends Display {
|
||||
}
|
||||
|
||||
static getSearchQueryFromLocation(url) {
|
||||
let match = /^[^?#]*\?(?:[^&#]*&)?query=([^&#]*)/.exec(url);
|
||||
const match = /^[^?#]*\?(?:[^&#]*&)?query=([^&#]*)/.exec(url);
|
||||
return match !== null ? decodeURIComponent(match[1]) : null;
|
||||
}
|
||||
}
|
||||
|
@ -447,8 +447,8 @@ class Frontend {
|
||||
}
|
||||
|
||||
getIndexOfTouch(touchList, identifier) {
|
||||
for (let i in touchList) {
|
||||
let t = touchList[i];
|
||||
for (const i in touchList) {
|
||||
const t = touchList[i];
|
||||
if (t.identifier === identifier) {
|
||||
return i;
|
||||
}
|
||||
|
@ -361,7 +361,7 @@ class TextSourceElement {
|
||||
|
||||
let consumed = 0;
|
||||
let content = '';
|
||||
for (let currentChar of this.content || '') {
|
||||
for (const currentChar of this.content || '') {
|
||||
if (consumed >= length) {
|
||||
break;
|
||||
} else if (!currentChar.match(IGNORE_TEXT_PATTERN)) {
|
||||
|
Loading…
Reference in New Issue
Block a user