feat: add FindValuesBy

This commit is contained in:
dudaodong committed 2025-04-01 11:35:24 +08:00
1 parent 3849337919
commit ceb706b874
5 files changed
+154 -5

No files matched your search

+18
View File
@@ -829,3 +829,21 @@ func ExampleOrderedMap_UnmarshalJSON() {
// fmt.Println(om.Elements())
}
func ExampleFindValuesBy() {
m := map[int]string{
1: "a",
2: "b",
3: "c",
4: "d",
}
result := FindValuesBy(m, func(k int, v string) bool {
return k%2 == 0
})
fmt.Println(result)
// Output:
// [b d]
}