Documentation ¶
Index ¶
- func Contains[T comparable](haystack []T, needle T) bool
- func Filter[T any](list []T, filterFunc func(item T) bool) []T
- func Find[T any](haystack []T, predicate func(T) bool) (T, bool)
- func Keys[T comparable, U any](m map[T]U) []T
- func Map[T, U any](list []T, f func(T) U) []U
- func PassEntry[E comparable](e E) E
- func Reduce[T, U any](list []T, initial U, f func(T, U) U) U
- func ReduceMap[K comparable, V, U any](m map[K]V, initial U, f func(K, V, U) U) U
- func Sort[T any](list []T, sortFunc func(l, r T) bool) []T
- func SortEntries[S ~[]E, E any, C comparable](list S, comparator func(l, r C) int, getter func(E) C) S
- func TryMap[T, U any](list []T, f func(T) (U, error)) ([]U, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Contains ¶
func Contains[T comparable](haystack []T, needle T) bool
Contains checks if the needle element exists in a given haystack
func Keys ¶
func Keys[T comparable, U any](m map[T]U) []T
Keys returns all map-keys for the provided map m
func Map ¶
func Map[T, U any](list []T, f func(T) U) []U
Map transforms the list by running the f func on each element in list
func PassEntry ¶ added in v0.3.0
func PassEntry[E comparable](e E) E
func Reduce ¶
func Reduce[T, U any](list []T, initial U, f func(T, U) U) U
Reduce maps and reduces f on every list item with the initial U
func ReduceMap ¶
func ReduceMap[K comparable, V, U any](m map[K]V, initial U, f func(K, V, U) U) U
ReduceMap maps and reduces f on every list item with the initial U
func SortEntries ¶ added in v0.3.0
func SortEntries[S ~[]E, E any, C comparable](list S, comparator func(l, r C) int, getter func(E) C) S
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.