mirror of
https://github.com/rjNemo/underscore
synced 2026-06-06 10:36:43 +00:00
10 lines
252 B
Go
10 lines
252 B
Go
package underscore
|
|
|
|
// Each iterates over a slice of elements, yielding each in turn to an action function.
|
|
// Returns the slice for piping.
|
|
func Each[T any](values []T, action func(T)) []T {
|
|
for _, v := range values {
|
|
action(v)
|
|
}
|
|
return values
|
|
}
|