A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
feat: add get favorites
thecodrr2e2258603a82
diff --git a/packages/core/__tests__/database.test.js b/packages/core/__tests__/database.test.jsindex cb92f0833..76ac35f5f 100644--- a/packages/core/__tests__/database.test.js+++ b/packages/core/__tests__/database.test.js@@ -80,6 +80,11 @@ test("update note", async () => {expect(note.colors).toStrictEqual(["red", "blue"]);});+test("get favorites", () => {+ let favorites = db.getFavorites();+ expect(favorites.length).toBeGreaterThan(0);+});+test("note with text longer than 150 characters should have ... in the headline", () => {let note = db.getNote(TEST_NOTE.dateCreated);expect(note.headline.includes("...")).toBe(true);diff --git a/packages/core/api/database.js b/packages/core/api/database.jsindex 8340ec329..160c8f4c1 100644--- a/packages/core/api/database.js+++ b/packages/core/api/database.js@@ -55,6 +55,10 @@ class Database {return extractValues(this.notes).reverse();}+ getFavorites() {+ return tfun.filter(".favorite = true")(extractValues(this.notes));+ }+/*** Group notes by given criteria* @param {string} by One from 'abc', 'month', 'year' or 'week'. Leave it empty for default grouping.