From dd6d077c363af69dc00439841bae0d066879ec1a Mon Sep 17 00:00:00 2001 From: Ruidy Date: Wed, 29 Dec 2021 13:07:40 -0400 Subject: [PATCH] doc: find --- find.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/find.go b/find.go index 0272ccd..fd0f90c 100644 --- a/find.go +++ b/find.go @@ -2,6 +2,9 @@ package underscore import "errors" +// Find looks through each value in the slice, returning the first one that passes a truth test (predicate), +// or the default value for the type and an error if no value passes the test. +// The function returns as soon as it finds an acceptable element, and doesn't traverse the entire slice. func Find[T any](values []T, predicate func(T) bool) (res T, err error) { for _, v := range values { if predicate(v) {