diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-08-09 21:04:09 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-09 21:04:09 -0400 |
commit | 9f8f83508e6d8e469b8cd89c1fb3ec85601401d8 (patch) | |
tree | fe5bb466250b18520ce2116a6e920b4c2d6b638f /ext/bg/js/dictionary-database.js | |
parent | f502dd4f21b273ecf2486cfeffddf3a3432a955c (diff) |
Merge dictionary.js functions into Translator class (#726)
* Move dictFieldSplit
* Copy dictionary.js definitions into translator.js
* Convert to member functions
* Refactor names
* Remove dictionary.js
* Rename
Diffstat (limited to 'ext/bg/js/dictionary-database.js')
-rw-r--r-- | ext/bg/js/dictionary-database.js | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/ext/bg/js/dictionary-database.js b/ext/bg/js/dictionary-database.js index 671be7a8..c6798fb3 100644 --- a/ext/bg/js/dictionary-database.js +++ b/ext/bg/js/dictionary-database.js @@ -17,7 +17,6 @@ /* global * Database - * dictFieldSplit */ class DictionaryDatabase { @@ -436,9 +435,9 @@ class DictionaryDatabase { index, expression: row.expression, reading: row.reading, - definitionTags: dictFieldSplit(row.definitionTags || row.tags || ''), - termTags: dictFieldSplit(row.termTags || ''), - rules: dictFieldSplit(row.rules), + definitionTags: this._splitField(row.definitionTags || row.tags || ''), + termTags: this._splitField(row.termTags || ''), + rules: this._splitField(row.rules), glossary: row.glossary, score: row.score, dictionary: row.dictionary, @@ -451,9 +450,9 @@ class DictionaryDatabase { return { index, character: row.character, - onyomi: dictFieldSplit(row.onyomi), - kunyomi: dictFieldSplit(row.kunyomi), - tags: dictFieldSplit(row.tags), + onyomi: this._splitField(row.onyomi), + kunyomi: this._splitField(row.kunyomi), + tags: this._splitField(row.tags), glossary: row.meanings, stats: row.stats, dictionary: row.dictionary @@ -471,4 +470,8 @@ class DictionaryDatabase { _createMedia(row, index) { return Object.assign({}, row, {index}); } + + _splitField(field) { + return field.length === 0 ? [] : field.split(' '); + } } |