Create function for creating kanji data and meta
This commit is contained in:
parent
6743b785c9
commit
9364a7cb4e
@ -123,7 +123,7 @@ class Database {
|
|||||||
const results = [];
|
const results = [];
|
||||||
const processRow = (row, index) => {
|
const processRow = (row, index) => {
|
||||||
if (titles.includes(row.dictionary)) {
|
if (titles.includes(row.dictionary)) {
|
||||||
results.push(Database.createTermMeta(row, index));
|
results.push(Database.createMeta(row, index));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -148,15 +148,7 @@ class Database {
|
|||||||
const results = [];
|
const results = [];
|
||||||
await this.db.kanji.where('character').equals(kanji).each(row => {
|
await this.db.kanji.where('character').equals(kanji).each(row => {
|
||||||
if (titles.includes(row.dictionary)) {
|
if (titles.includes(row.dictionary)) {
|
||||||
results.push({
|
results.push(Database.createKanji(row));
|
||||||
character: row.character,
|
|
||||||
onyomi: dictFieldSplit(row.onyomi),
|
|
||||||
kunyomi: dictFieldSplit(row.kunyomi),
|
|
||||||
tags: dictFieldSplit(row.tags),
|
|
||||||
glossary: row.meanings,
|
|
||||||
stats: row.stats,
|
|
||||||
dictionary: row.dictionary
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -169,11 +161,7 @@ class Database {
|
|||||||
const results = [];
|
const results = [];
|
||||||
await this.db.kanjiMeta.where('character').equals(kanji).each(row => {
|
await this.db.kanjiMeta.where('character').equals(kanji).each(row => {
|
||||||
if (titles.includes(row.dictionary)) {
|
if (titles.includes(row.dictionary)) {
|
||||||
results.push({
|
results.push(Database.createMeta(row));
|
||||||
mode: row.mode,
|
|
||||||
data: row.data,
|
|
||||||
dictionary: row.dictionary
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -494,7 +482,20 @@ class Database {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static createTermMeta(row, index) {
|
static createKanji(row, index) {
|
||||||
|
return {
|
||||||
|
index,
|
||||||
|
character: row.character,
|
||||||
|
onyomi: dictFieldSplit(row.onyomi),
|
||||||
|
kunyomi: dictFieldSplit(row.kunyomi),
|
||||||
|
tags: dictFieldSplit(row.tags),
|
||||||
|
glossary: row.meanings,
|
||||||
|
stats: row.stats,
|
||||||
|
dictionary: row.dictionary
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
static createMeta(row, index) {
|
||||||
return {
|
return {
|
||||||
index,
|
index,
|
||||||
mode: row.mode,
|
mode: row.mode,
|
||||||
|
Loading…
Reference in New Issue
Block a user