-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add fuzzy usability improvemnts (#7)
- add fuzzy usability improvements - bump go version to 1.23
- Loading branch information
Showing
7 changed files
with
76 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module github.com/prnvbn/clocks | ||
|
||
go 1.21.3 | ||
go 1.23.1 | ||
|
||
require ( | ||
github.com/adrg/xdg v0.4.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package match | ||
|
||
import ( | ||
"strings" | ||
|
||
"github.com/lithammer/fuzzysearch/fuzzy" | ||
) | ||
|
||
func Fuzzy(searchTerm string, toMatch string) bool { | ||
return fuzzy.Match(strings.ToLower(searchTerm), strings.ToLower(toMatch)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package tmz | ||
|
||
import ( | ||
"iter" | ||
|
||
"github.com/prnvbn/clocks/internal/match" | ||
) | ||
|
||
func FilteredCountries(searchTerm string) iter.Seq[string] { | ||
return func(yield func(string) bool) { | ||
for cntry := range CountryZonesMap { | ||
if match.Fuzzy(searchTerm, cntry) { | ||
if !yield(cntry) { | ||
return | ||
} | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters