Skip to content

Commit

Permalink
Small filter optimization (#147)
Browse files Browse the repository at this point in the history
  • Loading branch information
Evertras committed Mar 28, 2023
1 parent 7500ae9 commit cac6a97
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion table/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ func isRowMatched(columns []Column, row Row, filter string) bool {

checkedAny := false

filterLower := strings.ToLower(filter)

for _, column := range columns {
if !column.filterable {
continue
Expand Down Expand Up @@ -59,7 +61,7 @@ func isRowMatched(columns []Column, row Row, filter string) bool {
target = fmt.Sprintf("%v", data)
}

if strings.Contains(strings.ToLower(target), strings.ToLower(filter)) {
if strings.Contains(strings.ToLower(target), filterLower) {
return true
}
}
Expand Down

0 comments on commit cac6a97

Please sign in to comment.