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..2df1c8e --- /dev/null +++ b/notes.md @@ -0,0 +1,21 @@ +*My Commit Message* +In store.js changed: +function matches(notes, term) { + return notes.filter((note) => note.text === term); +} + +to + +function matches(notes, term) { + return notes.filter((note) => note.text.includes(term)); +} + + +*Claude Commit Message* +Fix search to match substrings instead of exact text + +The matches() function was using strict equality (===) to compare note +text against the search term, so only notes whose full text was identical +to the term would be returned. Switch to String.prototype.includes() so +that search finds every note containing the term anywhere in its text, +which is what the feature is supposed to do.