Skip to content

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

docs: add basic jsdoc

thecodrre3165c3b220f
diff --git a/packages/core/collections/notebooks.js b/packages/core/collections/notebooks.js
index c955d18cd..2ce5f88da 100644
--- a/packages/core/collections/notebooks.js
+++ b/packages/core/collections/notebooks.js
@@ -67,6 +67,11 @@ export default class Notebooks {
return this.collection.getAllItems();
}
+ /**
+ *
+ * @param {string} id The id of the notebook
+ * @returns {Notebook} The notebook of the given id
+ */
notebook(id) {
let notebook = this.collection.getItem(id);
if (!notebook) return;
diff --git a/packages/core/collections/notes.js b/packages/core/collections/notes.js
index e9fb18512..136afb173 100644
--- a/packages/core/collections/notes.js
+++ b/packages/core/collections/notes.js
@@ -85,6 +85,11 @@ export default class Notes {
return note.id;
}
+ /**
+ *
+ * @param {string} id The id of note
+ * @returns {Note} The note of the given id
+ */
note(id) {
let note = this.collection.getItem(id);
if (!note) return undefined;
diff --git a/packages/core/collections/topics.js b/packages/core/collections/topics.js
index e3e7a2e0c..575b07da4 100644
--- a/packages/core/collections/topics.js
+++ b/packages/core/collections/topics.js
@@ -38,10 +38,18 @@ export default class Topics {
await this.notebooks.collection.addItem(notebook.data);
}
+ /**
+ * @returns {Array} an array containing all the topics
+ */
get all() {
return this.notebooks.notebook(this.notebookId).data.topics;
}
+ /**
+ *
+ * @param {string | Object} topic can be an object or string containing the topic title.
+ * @returns {Topic} The topic by the given title
+ */
topic(topic) {
if (typeof topic === "string") {
topic = this.all.find(t => t.title === topic);