From f5a260c229b74562ac738c8e22d0b1568ee441f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kier=C3=A1n=20Meinhardt?= Date: Wed, 30 Dec 2020 20:28:54 +0100 Subject: [PATCH] feat(seh2g): replace lodash by JS --- seh2g/index.html | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/seh2g/index.html b/seh2g/index.html index 8b5dcf5..8487101 100644 --- a/seh2g/index.html +++ b/seh2g/index.html @@ -11,7 +11,6 @@ href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.5/css/bulma.min.css" /> - @@ -106,18 +105,16 @@ }, computed: { results() { - return _.filter(this.books, this.bookMatches); + return this.books.filter(this.bookMatches); }, }, methods: { bookMatches(book) { - if (this.search.length < 3) { - return false; - } else - return _.includes( - _.toLower(_.toLower(JSON.stringify(book))), - _.toLower(_.toLower(this.search)) - ); + return this.search.length < 3 + ? false + : JSON.stringify(book) + .toLowerCase() + .includes(this.search.toLowerCase()); }, renderBook(book) { const text = ` @@ -130,7 +127,7 @@ const searchPattern = new RegExp(`${this.search}`, "gi"); - return _.replace(text, searchPattern, (x) => `${x}`); + return text.replace(searchPattern, (x) => `${x}`); }, }, });