aboutsummaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/bg/js/database.js12
-rw-r--r--ext/bg/js/deinflector.js14
-rw-r--r--ext/bg/js/translator.js14
-rw-r--r--ext/bg/js/util.js18
4 files changed, 29 insertions, 29 deletions
diff --git a/ext/bg/js/database.js b/ext/bg/js/database.js
index 3b2bcfcb..31573065 100644
--- a/ext/bg/js/database.js
+++ b/ext/bg/js/database.js
@@ -87,7 +87,7 @@ class Database {
}).then(() => {
return this.cacheTagMeta(dictionaries);
}).then(() => {
- for (let result of results) {
+ for (const result of results) {
result.tagMeta = this.tagMetaCache[result.dictionary] || {};
}
@@ -115,7 +115,7 @@ class Database {
}).then(() => {
return this.cacheTagMeta(dictionaries);
}).then(() => {
- for (let result of results) {
+ for (const result of results) {
result.tagMeta = this.tagMetaCache[result.dictionary] || {};
}
@@ -129,7 +129,7 @@ class Database {
}
const promises = [];
- for (let dictionary of dictionaries) {
+ for (const dictionary of dictionaries) {
if (this.tagMetaCache[dictionary]) {
continue;
}
@@ -170,7 +170,7 @@ class Database {
return this.db.dictionaries.add({title, version, revision, hasTerms, hasKanji}).then(() => {
const rows = [];
- for (let tag in tagMeta || {}) {
+ for (const tag in tagMeta || {}) {
const meta = tagMeta[tag];
const row = sanitizeTag({
name: tag,
@@ -190,7 +190,7 @@ class Database {
const termsLoaded = (title, entries, total, current) => {
const rows = [];
- for (let [expression, reading, tags, rules, score, ...glossary] of entries) {
+ for (const [expression, reading, tags, rules, score, ...glossary] of entries) {
rows.push({
expression,
reading,
@@ -211,7 +211,7 @@ class Database {
const kanjiLoaded = (title, entries, total, current) => {
const rows = [];
- for (let [character, onyomi, kunyomi, tags, ...meanings] of entries) {
+ for (const [character, onyomi, kunyomi, tags, ...meanings] of entries) {
rows.push({
character,
onyomi,
diff --git a/ext/bg/js/deinflector.js b/ext/bg/js/deinflector.js
index 256ae1a1..6e480068 100644
--- a/ext/bg/js/deinflector.js
+++ b/ext/bg/js/deinflector.js
@@ -32,8 +32,8 @@ class Deinflection {
if (this.rules.length === 0) {
this.definitions = definitions;
} else {
- for (let rule of this.rules) {
- for (let definition of definitions) {
+ for (const rule of this.rules) {
+ for (const definition of definitions) {
if (definition.rules.includes(rule)) {
this.definitions.push(definition);
}
@@ -46,11 +46,11 @@ class Deinflection {
};
const promises = [];
- for (let reason in reasons) {
- for (let variant of reasons[reason]) {
+ for (const reason in reasons) {
+ for (const variant of reasons[reason]) {
let accept = this.rules.length === 0;
if (!accept) {
- for (let rule of this.rules) {
+ for (const rule of this.rules) {
if (variant.rulesIn.includes(rule)) {
accept = true;
break;
@@ -95,8 +95,8 @@ class Deinflection {
}
const results = [];
- for (let child of this.children) {
- for (let result of child.gather()) {
+ for (const child of this.children) {
+ for (const result of child.gather()) {
if (this.reason.length > 0) {
result.reasons.push(this.reason);
}
diff --git a/ext/bg/js/translator.js b/ext/bg/js/translator.js
index 82dffd91..e7c2aac2 100644
--- a/ext/bg/js/translator.js
+++ b/ext/bg/js/translator.js
@@ -54,8 +54,8 @@ class Translator {
}
}).then(deinflections => {
let definitions = [];
- for (let deinflection of deinflections) {
- for (let definition of deinflection.definitions) {
+ for (const deinflection of deinflections) {
+ for (const definition of deinflection.definitions) {
const tags = definition.tags.map(tag => buildTag(tag, definition.tagMeta));
tags.push(buildDictTag(definition.dictionary));
definitions.push({
@@ -76,7 +76,7 @@ class Translator {
definitions = sortTermDefs(definitions, dictionaries);
let length = 0;
- for (let definition of definitions) {
+ for (const definition of definitions) {
length = Math.max(length, definition.source.length);
}
@@ -95,7 +95,7 @@ class Translator {
const processed = {};
const promises = [];
- for (let c of text) {
+ for (const c of text) {
if (!processed[c]) {
promises.push(this.database.findKanji(c, titles));
processed[c] = true;
@@ -104,7 +104,7 @@ class Translator {
return Promise.all(promises).then(defSets => {
const definitions = defSets.reduce((a, b) => a.concat(b), []);
- for (let definition of definitions) {
+ for (const definition of definitions) {
const tags = definition.tags.map(tag => buildTag(tag, definition.tagMeta));
tags.push(buildDictTag(definition.dictionary));
definition.tags = sortTags(tags);
@@ -130,7 +130,7 @@ class Translator {
return Promise.all(promises).then(results => {
let deinflections = [];
- for (let result of results) {
+ for (const result of results) {
deinflections = deinflections.concat(result);
}
@@ -139,7 +139,7 @@ class Translator {
}
processKanji(definitions) {
- for (let definition of definitions) {
+ for (const definition of definitions) {
const tags = definition.tags.map(tag => buildTag(tag, definition.tagMeta));
definition.tags = sortTags(tags);
}
diff --git a/ext/bg/js/util.js b/ext/bg/js/util.js
index 24050cf3..ec562f9f 100644
--- a/ext/bg/js/util.js
+++ b/ext/bg/js/util.js
@@ -19,7 +19,7 @@
function kanjiLinks(options) {
let result = '';
- for (let c of options.fn(this)) {
+ for (const c of options.fn(this)) {
if (isKanji(c)) {
result += `<a href="#" class="kanji-link">${c}</a>`;
} else {
@@ -41,7 +41,7 @@ function isKanji(c) {
function enabledDicts(options) {
const dictionaries = {};
- for (let title in options.dictionaries) {
+ for (const title in options.dictionaries) {
const dictionary = options.dictionaries[title];
if (dictionary.enabled) {
dictionaries[title] = dictionary;
@@ -104,7 +104,7 @@ function sortTermDefs(definitions, dictionaries=null) {
function undupeTermDefs(definitions) {
const definitionGroups = {};
- for (let definition of definitions) {
+ for (const definition of definitions) {
const definitionExisting = definitionGroups[definition.id];
if (!definitionGroups.hasOwnProperty(definition.id) || definition.expression.length > definitionExisting.expression.length) {
definitionGroups[definition.id] = definition;
@@ -112,7 +112,7 @@ function undupeTermDefs(definitions) {
}
const definitionsUnique = [];
- for (let key in definitionGroups) {
+ for (const key in definitionGroups) {
definitionsUnique.push(definitionGroups[key]);
}
@@ -121,7 +121,7 @@ function undupeTermDefs(definitions) {
function groupTermDefs(definitions, dictionaries) {
const groups = {};
- for (let definition of definitions) {
+ for (const definition of definitions) {
const key = [definition.source, definition.expression].concat(definition.reasons);
if (definition.reading) {
key.push(definition.reading);
@@ -136,7 +136,7 @@ function groupTermDefs(definitions, dictionaries) {
}
const results = [];
- for (let key in groups) {
+ for (const key in groups) {
const groupDefs = groups[key];
const firstDef = groupDefs[0];
sortTermDefs(groupDefs, dictionaries);
@@ -160,7 +160,7 @@ function buildDictTag(name) {
function buildTag(name, meta) {
const tag = {name};
const symbol = name.split(':')[0];
- for (let prop in meta[symbol] || {}) {
+ for (const prop in meta[symbol] || {}) {
tag[prop] = meta[symbol][prop];
}
@@ -217,7 +217,7 @@ function formatField(field, definition, mode, options) {
'url'
];
- for (let marker of markers) {
+ for (const marker of markers) {
const data = {
marker,
definition,
@@ -304,7 +304,7 @@ function importJsonDb(indexUrl, indexLoaded, termsLoaded, kanjiLoaded) {
}
let chain = Promise.resolve();
- for (let loader of loaders) {
+ for (const loader of loaders) {
chain = chain.then(loader);
}