diff options
author | Alex Yatskov <alex@foosoft.net> | 2017-09-17 19:57:39 -0700 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2017-09-17 19:57:39 -0700 |
commit | e90274519a57d43e77e864ed3259d1b6c73654be (patch) | |
tree | 6881cba90ad3123b36142d5a1da6fa3900d2ae0f /ext/bg/js/translator.js | |
parent | d9d16613f8aa129de5dc1edb38d66f69d2983091 (diff) |
combine indices and stats
Diffstat (limited to 'ext/bg/js/translator.js')
-rw-r--r-- | ext/bg/js/translator.js | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/ext/bg/js/translator.js b/ext/bg/js/translator.js index ef2227ea..7583d39a 100644 --- a/ext/bg/js/translator.js +++ b/ext/bg/js/translator.js @@ -140,8 +140,7 @@ class Translator { tags.push(dictTagBuildSource(definition.dictionary)); definition.tags = dictTagsSort(tags); - definition.stats = await this.expandTaggedValues(definition.stats, definition.dictionary); - definition.indices = await this.expandTaggedValues(definition.indices, definition.dictionary); + definition.stats = await this.expandStats(definition.stats, definition.dictionary); definition.frequencies = await this.database.findKanjiFreq(definition.character, titles); } @@ -174,22 +173,22 @@ class Translator { return tags; } - async expandTaggedValues(items, title) { - const tags = []; + async expandStats(items, title) { + const stats = []; for (const name in items) { const base = name.split(':')[0]; const meta = await this.database.findTagForTitle(base, title); - const tag = {name, value: items[name]}; + const stat = {name, value: items[name]}; for (const prop in meta || {}) { if (prop !== 'name') { - tag[prop] = meta[prop]; + stat[prop] = meta[prop]; } } - tags.push(dictTagSanitize(tag)); + stats.push(dictTagSanitize(stat)); } - return tags; + return stats; } } |