Skip to content

Commit a518da9

Browse files
committed
chore: update doc of FindKey
1 parent 28a13aa commit a518da9

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

presence.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func Find(arr interface{}, predicate interface{}) interface{} {
5656
}
5757

5858
// Find iterates over elements of collection, returning the first
59-
// element predicate returns truthy for.
59+
// element of an array and random of a map which predicate returns truthy for.
6060
func FindKey(arr interface{}, predicate interface{}) (matchKey, matchEle interface{}) {
6161
if !IsIteratee(arr) {
6262
panic("First parameter must be an iteratee")

presence_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ func TestFindKey(t *testing.T) {
154154
is := assert.New(t)
155155

156156
k, r := FindKey(map[string]int{"a": 1, "b": 2, "c": 3, "d": 4}, func(x int) bool {
157-
return x%2 == 0
157+
return x == 2
158158
})
159159

160160
is.Equal(r, 2)

0 commit comments

Comments
 (0)