Fixing blank tags

This commit is contained in:
Alex Yatskov 2016-10-21 21:33:54 -07:00
parent 83f5bd24df
commit e51f43886b
2 changed files with 8 additions and 4 deletions

View File

@ -79,7 +79,7 @@ class Dictionary {
results.push({ results.push({
expression: row.expression, expression: row.expression,
reading: row.reading, reading: row.reading,
tags: row.tags.split(' '), tags: splitField(row.tags),
glossary: row.glossary, glossary: row.glossary,
id: row.id id: row.id
}); });
@ -103,9 +103,9 @@ class Dictionary {
return this.db.kanji.where('character').equals(kanji).each(row => { return this.db.kanji.where('character').equals(kanji).each(row => {
results.push({ results.push({
character: row.character, character: row.character,
onyomi: row.onyomi.split(' '), onyomi: splitField(row.onyomi),
kunyomi: row.kunyomi.split(' '), kunyomi: splitField(row.kunyomi),
tags: row.tags.split(' '), tags: splitField(row.tags),
glossary: row.meanings glossary: row.meanings
}); });
}).then(() => results); }).then(() => results);

View File

@ -112,3 +112,7 @@ function applyTagMeta(tag, meta) {
return tag; return tag;
} }
function splitField(field) {
return field.length === 0 ? [] : field.split(' ');
}