diff options
-rw-r--r-- | iridescence/src/store/index.js | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/iridescence/src/store/index.js b/iridescence/src/store/index.js index b324bd1..709dc79 100644 --- a/iridescence/src/store/index.js +++ b/iridescence/src/store/index.js @@ -17,17 +17,13 @@ export default new Vuex.Store({ }, getters: { products(state) { + let term = state.searchTerm.toLowerCase(); return state.products .filter(item => { - let haystack = [ - item.id, - item.name, - item.description, - item.category - ].join(""); - return haystack + return [item.id, item.name, item.description, item.category] + .join("") .toLowerCase() - .includes(state.searchTerm.toLowerCase()); + .includes(term); }) .sort(state.compare); }, |