Documentation ¶
Index ¶
- func BinarySearch[T any](slice []T, val T, compare func(T, T) int) int
- func SliceContains[T comparable](arr []T, val T) bool
- func SliceCopy[T any](arr []T) []T
- func SliceMapper[T any, V any](items []T, mpr func(T) V) []V
- func SliceMapperError[T any, V any](items []T, mpr func(T) (V, error)) (slice []V, err error)
- func SliceMapperFilter[T any, V any](items []T, mpr func(T) (bool, V)) []V
- func SliceUnique[T any, C comparable](arr []T, eq func(T) C) []T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BinarySearch ¶ added in v0.11.0
BinarySearch searches for a value in a sorted slice and returns the index of the value. If the value is not found, it returns -1
func SliceContains ¶
func SliceContains[T comparable](arr []T, val T) bool
func SliceMapper ¶
func SliceMapperError ¶
func SliceMapperFilter ¶
func SliceUnique ¶
func SliceUnique[T any, C comparable](arr []T, eq func(T) C) []T
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.