Documentation ¶
Index ¶
- func ForEach[T any](collection []T, iteratee func(item T, index int))
- func GroupBy[T any, U comparable, Slice ~[]T](collection Slice, iteratee func(item T) U) map[U]Slice
- func Map[T any, R any](collection []T, iteratee func(item T, index int) R) []R
- func PartitionBy[T any, K comparable, Slice ~[]T](collection Slice, iteratee func(item T) K) []Slice
- func Times[T any](count int, iteratee func(index int) T) []T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ForEach ¶
ForEach iterates over elements of collection and invokes iteratee for each element. `iteratee` is call in parallel.
func GroupBy ¶ added in v1.4.0
func GroupBy[T any, U comparable, Slice ~[]T](collection Slice, iteratee func(item T) U) map[U]Slice
GroupBy returns an object composed of keys generated from the results of running each element of collection through iteratee. `iteratee` is call in parallel.
func Map ¶
Map manipulates a slice and transforms it to a slice of another type. `iteratee` is call in parallel. Result keep the same order.
func PartitionBy ¶ added in v1.4.0
func PartitionBy[T any, K comparable, Slice ~[]T](collection Slice, iteratee func(item T) K) []Slice
PartitionBy returns an array of elements split into groups. The order of grouped values is determined by the order they occur in collection. The grouping is generated from the results of running each element of collection through iteratee. `iteratee` is call in parallel.
Types ¶
This section is empty.