Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FindKeyBy value constraint should be relaxed to any #204

Closed
powerman opened this issue Aug 17, 2022 · 0 comments · Fixed by #205
Closed

FindKeyBy value constraint should be relaxed to any #204

powerman opened this issue Aug 17, 2022 · 0 comments · Fixed by #205

Comments

@powerman
Copy link
Contributor

Real use case: map of maps. When map's value type is another map it is not comparable, but this isn't required to run predicate function.

Example:

var m map[K1]map[K2]V2
_, found := lo.FindKeyBy(m, func(k1 K1, v1 map[K2]V2) bool {
	_, found := lo.FindKeyBy(v1, func(k2 K2, v2 V2) bool {
		return match(v2)
	})
	return found
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants