parsing words fields

This commit is contained in:
micialware committed 2026-09-14 20:59:52 +03:00
1 parent b76d115d7e
commit 8a0834abac
1 file changed
+13 -4
+13 -4
View File
@@ -38,20 +38,29 @@ export interface Word {
key: string;
value: string;
tags: string;
more: string | null;
more: Map<number, string>;
group_id: number;
}
export async function wordList() {
let rows = await query("SELECT id, key, value, tags, more, group_id FROM words");
return rows.map((row: any) => ({
return rows.map((row: any) => {
let more : string = row.more.split('');
let dict = new Map();
for (let i = 0; i < more.length / 2; i++) {
dict.set(more[i * 2], more[i * 2 + 1]);
}
let w = {
id: row.id,
key: row.key,
value: row.value,
tags: row.tags,
more: row.more,
more: dict,
group_id: row.group_id,
})) as Word[];
}
return w;
}) as Word[];
}
export interface HistoryEntry {