From 8b5e17a76644d4fa22ca6fce27741dbf5a5dbb7f Mon Sep 17 00:00:00 2001 From: Nathanael Beta Date: Mon, 15 Jun 2026 10:00:42 +0700 Subject: [PATCH] fix: use includes() in matches() for substring search Replace strict equality with String.prototype.includes() so searching a term returns all notes containing it, not just exact matches. Also add notes.md documenting the fix. Co-Authored-By: Claude Sonnet 4.6 --- lib/store.js | 2 +- notes.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 notes.md diff --git a/lib/store.js b/lib/store.js index 1d9215f..7ceefa0 100644 --- a/lib/store.js +++ b/lib/store.js @@ -38,7 +38,7 @@ function remove(id) { // Returns the notes that match `term`. function matches(notes, term) { - return notes.filter((note) => note.text === term); + return notes.filter((note) => note.text.includes(term)); } function search(term) { diff --git a/notes.md b/notes.md new file mode 100644 index 0000000..d4ebf27 --- /dev/null +++ b/notes.md @@ -0,0 +1 @@ +I fix the matches function \ No newline at end of file