From 183947552934326bb3763a62b3875897d0326b28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alen=20=C5=A0iljak?= <462445+alensiljak@users.noreply.github.com> Date: Sun, 24 Nov 2024 20:51:14 +0100 Subject: [PATCH] renaming, using TS --- src/{ListSearch.js => ListSearch.ts} | 8 ++++---- src/pages/Payees.vue | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) rename src/{ListSearch.js => ListSearch.ts} (90%) diff --git a/src/ListSearch.js b/src/ListSearch.ts similarity index 90% rename from src/ListSearch.js rename to src/ListSearch.ts index 8398339..7210fa3 100644 --- a/src/ListSearch.js +++ b/src/ListSearch.ts @@ -20,19 +20,19 @@ export class ListSearch { * @param {string} searchTerm as typed by the user. * @returns A boolean indicating if there is a match. */ - search(searchTerm) { + search(searchTerm: string) { // let expression = '^(?=.*\bjack\b)(?=.*\bjames\b).*$' const regex = this.getRegex(searchTerm) return regex.test(searchTerm) } - getExpression(searchTerm) { + getExpression(searchTerm: string) { // this is looking for whole words only // ^(?=.*\bjack\b)(?=.*\bjames\b).*$ // split the search terms const searchTerms = searchTerm.split(' ') - var expression = '^' + let expression = '^' for (let i = 0; i < searchTerms.length; i++) { if (!searchTerms[i]) continue @@ -43,7 +43,7 @@ export class ListSearch { return expression } - getRegex(searchTerm) { + getRegex(searchTerm: string) { const expression = this.getExpression(searchTerm) const regex = new RegExp(expression, 'i') diff --git a/src/pages/Payees.vue b/src/pages/Payees.vue index a8c4ef7..6ce1a34 100644 --- a/src/pages/Payees.vue +++ b/src/pages/Payees.vue @@ -57,7 +57,7 @@ onMounted(async () => { await loadData() } catch (error: any) { console.error(error) - Notification.negative(error.message) + Notification.error(error.message) } })