Documentation
¶
Index ¶
- func All[T comparable](vs []T, f func(T) bool) bool
- func Any[T comparable](vs []T, f func(T) bool) bool
- func Contains[T comparable](vs []T, t T) bool
- func Dedup[T comparable](in []T) (out []T)
- func Equal[T comparable](s1 []T, s2 []T) bool
- func Filter[T comparable](vs []T, f func(T) bool) []T
- func Include(vs []string, t string) bool
- func Index(vs []string, t string) int
- func IndexOf[T comparable](vs []T, t T) int
- func Map[I, R any](vs []I, f func(I) R) []R
- func MapI[T any](vs []T, f func(T) interface{}) []interface{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func All ¶
func All[T comparable](vs []T, f func(T) bool) bool
All returns true if all the elements in the slice satisfy the predicate f
func Any ¶
func Any[T comparable](vs []T, f func(T) bool) bool
Any returns true if one of the element in the slice satisfies the predicate f
func Contains ¶ added in v0.1.5
func Contains[T comparable](vs []T, t T) bool
Contains returns true if the target element t is in the slice.
func Dedup ¶ added in v0.1.4
func Dedup[T comparable](in []T) (out []T)
Dedup returns the input slice after removing duplicated items
func Equal ¶ added in v0.1.3
func Equal[T comparable](s1 []T, s2 []T) bool
Equal checks whether 2 slices have the same items
func Filter ¶
func Filter[T comparable](vs []T, f func(T) bool) []T
Filter returns a new slice containing all in the slice that satisfy the predicate f
func IndexOf ¶ added in v0.1.5
func IndexOf[T comparable](vs []T, t T) int
IndexOf returns the first index of the target element t, or -1 if no match is found
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.