From 5dd856cd00c926b7753954b3c07f077128b852d4 Mon Sep 17 00:00:00 2001 From: "Adam T. Carpenter" Date: Mon, 4 Jan 2021 17:02:27 -0500 Subject: more searching improvements; much faster now --- iridescence/src/store/index.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'iridescence') 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); }, -- cgit v1.2.3