Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix: make sure the tests pass

thecodrr2753d522159b
diff --git a/packages/core/api/database.js b/packages/core/api/database.js
index 0b7100dad..af9581ac2 100644
--- a/packages/core/api/database.js
+++ b/packages/core/api/database.js
@@ -15,8 +15,8 @@ class Database {
this.notebooks = {};
// fill data
- for (let key of KEYS) {
- this.storage.read(key).then(data => (this[key] = data));
+ for (let key of extractValues(KEYS)) {
+ this.storage.read(key).then(data => (this[key] = data || {}));
}
}
@@ -189,9 +189,9 @@ class Database {
if (!notebookId || !topic || !this.notebooks[notebookId]) return;
let notebook = this.notebooks[notebookId];
if (!notebook.topics[topic]) return;
- let topic = notebook.topics[topic];
- if (topic.length <= 0) return [];
- return topic.map(note => this.getNote(note));
+ let nbTopic = notebook.topics[topic];
+ if (nbTopic.length <= 0) return [];
+ return nbTopic.map(note => this.getNote(note));
}
/**