Documentation ¶
Index ¶
- func All[T any](vs []T, condition func(T) bool) bool
- func Any[T any](vs []T, condition func(T) bool) bool
- func Append[T any](arr []T, items ...T) []T
- func AppendArr[T any](arr []T, items ...[]T) []T
- func Clone[T any](arr []T) []T
- func Contains[T comparable](arr []T, item T) bool
- func ContainsAll[T comparable](arr []T, items ...T) bool
- func ContainsAny[T comparable](arr []T, items ...T) bool
- func EditEach[T any](arr []T, f func(index int, data T) T)
- func Find[T any](vs []T, condition func(T) bool) (val T, ok bool)
- func FindIndex[T any](vs []T, condition func(T) bool) (int, bool)
- func FindLast[T any](vs []T, condition func(T) bool) (val T, ok bool)
- func FindLastIndex[T any](vs []T, condition func(T) bool) (int, bool)
- func First[T any](l []T) (fst T, ok bool)
- func ForEach[T any](arr []T, f func(index int, data T))
- func ForEachRef[T any](arr []T, f func(index int, data *T))
- func HasDuplicate[T comparable](arr []T) bool
- func Last[T any](l []T) (last T, ok bool)
- func Map[T any, K any](from []T, tx func(T) K) []K
- func NotEmpty[T any](a ...[]T) bool
- func NotNil(a ...any) bool
- func PreAppend[T any](item T, slice []T) []T
- func RemoveAt[T any](arr []T, i int) []T
- func RemoveDuplicate[T comparable](arr []T) []T
- func Reverse[T any](a []T)
- func SafeIndex[T any](s []T, i int, ifFailed T) T
- func Shuffle[T any](array []T)
- func Sum[T constrains.Calculable](arr []T) T
- func Where[T1 any](vs []T1, condition func(T1) bool) []T1
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func All ¶ added in v0.0.13
All returns true if the provided function returns true for every element in the array.
func Any ¶ added in v0.0.13
Any returns true if the provided function returns true for any element in the array.
func Contains ¶
func Contains[T comparable](arr []T, item T) bool
Contains returns true if the array contains the item.
func ContainsAll ¶ added in v0.0.16
func ContainsAll[T comparable](arr []T, items ...T) bool
func ContainsAny ¶ added in v0.0.14
func ContainsAny[T comparable](arr []T, items ...T) bool
func Find ¶ added in v0.0.13
Find returns the first element in the array that satisfies the provided testing function.
func FindIndex ¶ added in v0.0.13
FindIndex returns the index of the first element in the array that satisfies the provided testing function.
func FindLast ¶ added in v0.0.13
FindLast returns the last element in the array that satisfies the provided testing function.
func FindLastIndex ¶ added in v0.0.13
FindLastIndex returns the index of the last element in the array that satisfies the provided testing function.
func ForEachRef ¶ added in v0.0.14
func HasDuplicate ¶
func HasDuplicate[T comparable](arr []T) bool
HasDuplicate returns true if the array has duplicate items.
func Map ¶
Map returns a new array with the results of calling a provided function on every element in the calling array.
func RemoveDuplicate ¶
func RemoveDuplicate[T comparable](arr []T) []T
RemoveDuplicate returns a new array without duplicate items.
func Sum ¶
func Sum[T constrains.Calculable](arr []T) T
Types ¶
This section is empty.