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
refactor: slight performance improvements
thecodrr66ba9c4f9f96
diff --git a/packages/core/api/database.js b/packages/core/api/database.jsindex 2f08d83ec..d3f0acd10 100644--- a/packages/core/api/database.js+++ b/packages/core/api/database.js@@ -1,6 +1,7 @@import Storage from "../helpers/storage";import fuzzysearch from "fuzzysearch";import ff from "fast-filter";+import { extractValues } from "../utils";const KEYS = {notes: "notes"@@ -18,7 +19,7 @@ class Database {async getNotes() {//update our cachethis.notes = (await this.storage.read(KEYS.notes)) || {};- return Object.values(this.notes);+ return extractValues(this.notes);}/**@@ -89,7 +90,7 @@ class Database {if (!notes) return;return ff(notes,- v => fuzzysearch(query, v.title) || fuzzysearch(query, v.content.text),+ v => fuzzysearch(query, v.title + " " + v.content.text),this);}diff --git a/packages/core/utils/index.js b/packages/core/utils/index.jsnew file mode 100644index 000000000..2d683cc29--- /dev/null+++ b/packages/core/utils/index.js@@ -0,0 +1,7 @@+export function extractValues(obj) {+ const t = [];+ for (var key in obj) {+ t[t.length] = obj[key];+ }+ return t;+}