Skip to content

Commit

Permalink
more efficient queries with single lowercase
Browse files Browse the repository at this point in the history
  • Loading branch information
undergroundwires committed Jan 11, 2020
1 parent 97a7747 commit 19813b6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/application/State/Filter/UserFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ export class UserFilter implements IUserFilter {
if (!filter) {
throw new Error('Filter must be defined and not empty. Use removeFilter() to remove the filter');
}
const filterLowercase = filter.toLocaleLowerCase();
const filteredScripts = this.application.getAllScripts().filter(
(script) =>
script.name.toLowerCase().includes(filter.toLowerCase()) ||
script.code.toLowerCase().includes(filter.toLowerCase()));
script.name.toLowerCase().includes(filterLowercase) ||
script.code.toLowerCase().includes(filterLowercase));
const filteredCategories = this.application.getAllCategories().filter(
(script) => script.name.toLowerCase().includes(filter.toLowerCase()));
(script) => script.name.toLowerCase().includes(filterLowercase));

const matches = new FilterResult(
filteredScripts,
Expand Down

0 comments on commit 19813b6

Please sign in to comment.