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..9f28886 --- /dev/null +++ b/notes.md @@ -0,0 +1,19 @@ +# Mi mensaje de commit (versión rápida) + +fix search + +# Mensaje de Claude + +``` +Fix search to match notes containing the term + +matches() compared note.text with === term, so `notes search milk` +only found a note whose entire text was "milk" and missed notes like +"buy milk". Use String.includes so search returns every note that +contains the term, as the README documents. The two failing search +tests in tests/notes.test.js now pass. +``` + +# Comparación + +El mío dice solo el *qué* ("fix search") y no aclara qué estaba roto. El de Claude explica el *por qué*: la causa (`===` en lugar de `includes`), un ejemplo concreto (`milk` vs `buy milk`), la referencia al comportamiento documentado en el README y el efecto en los tests. Es más largo, pero alguien que lea el historial entiende el cambio sin abrir el diff.