Skip to content

Commit

Permalink
feat: relax FindKeyBy constraint (#205)
Browse files Browse the repository at this point in the history
  • Loading branch information
powerman committed Aug 28, 2022
1 parent cf45927 commit b890954
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion find.go
Expand Up @@ -98,7 +98,7 @@ func FindKey[K comparable, V comparable](object map[K]V, value V) (K, bool) {
}

// FindKeyBy returns the key of the first element predicate returns truthy for.
func FindKeyBy[K comparable, V comparable](object map[K]V, predicate func(K, V) bool) (K, bool) {
func FindKeyBy[K comparable, V any](object map[K]V, predicate func(K, V) bool) (K, bool) {
for k, v := range object {
if predicate(k, v) {
return k, true
Expand Down

0 comments on commit b890954

Please sign in to comment.