Skip to content

Commit

Permalink
renaming, using TS
Browse files Browse the repository at this point in the history
  • Loading branch information
alensiljak committed Nov 24, 2024
1 parent 66d0ca8 commit 1839475
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/ListSearch.js → src/ListSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Payees.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ onMounted(async () => {
await loadData()
} catch (error: any) {
console.error(error)
Notification.negative(error.message)
Notification.error(error.message)
}
})
Expand Down

0 comments on commit 1839475

Please sign in to comment.