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

View File

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