Documentation
¶
Index ¶
- Variables
- func At[T any](arr []T, index int) (T, bool)
- func Concat[T any](arr []T, src ...[]T) []T
- func CopyWithin[T any](arr []T, target int, args ...int) []T
- func Every[T any](arr []T, fn func(int, T) bool) bool
- func Fill[T any](arr []T, element T, args ...int) []T
- func Filter[T any](arr []T, fn func(int, T) bool) []T
- func Find[T any](arr []T, fn func(int, T) bool) (T, bool)
- func FindIndex[T any](arr []T, fn func(int, T) bool) int
- func FindLast[T any](arr []T, fn func(int, T) bool) (T, bool)
- func FindLastIndex[T any](arr []T, fn func(int, T) bool) int
- func Flat[T any](arr []T, args ...int) []T
- func FlatMap[T any](arr []T, fn func(int, T) T) []T
- func ForEach[T any](arr []T, fn func(int, T))
- func Includes[T comparable](arr []T, element T) bool
- func IndexOf[T comparable](arr []T, element T) int
- func Join[T Stringer](arr []T, sep string) string
- func Keys[T any](arr []T) []int
- func LastIndexOf[T comparable](arr []T, element T) int
- func Map[T, V any](arr []T, fn func(int, T) V) []V
- func Pop[T any](arr *[]T) (T, bool)
- func Push[T any](arr *[]T, elements ...T) int
- func Reduce[T any](arr []T, fn func(accumulator, current T) T, initial T) T
- func ReduceRight[T any](arr []T, fn func(accumulator, current T) T, initial T) T
- func Reverse[T any](arr []T) []T
- func Shift[T any](arr *[]T) (T, bool)
- func Slice[T any](arr []T, args ...int) []T
- func Some[T any](arr []T, fn func(int, T) bool) bool
- func Sort[T any](arr []T, fn func(i, j int) bool) []T
- func Splice[T any](arr *[]T, start, deleteCount int, items ...T) []T
- func ToReserved[T any](arr []T) []T
- func ToSorted[T any](arr []T, fn func(T, T) bool) []T
- func ToString[T any](arr []T) string
- func Unshift[T any](arr *[]T, elements ...T) int
- func With[T any](arr []T, index int, element T) []T
- type Iterator
- type Stringer
Constants ¶
This section is empty.
Variables ¶
var ErrRange = errors.New("range error")
Functions ¶
func CopyWithin ¶
func Every ¶
Every returns true if all elements in an array pass the test implemented by the provided function
func Filter ¶
Filter returns a new array with all elements that pass the test implemented by the provided function
func FindLastIndex ¶
FindLastIndex returns the last index of an element in an array
func FlatMap ¶
FlatMap executes a provided function once for each array element and returns a new flattened array
func Includes ¶
func Includes[T comparable](arr []T, element T) bool
func IndexOf ¶
func IndexOf[T comparable](arr []T, element T) int
func LastIndexOf ¶
func LastIndexOf[T comparable](arr []T, element T) int
func Push ¶
Push adds one or more elements to the end of an array and returns the new length of the array
func Reduce ¶
func Reduce[T any](arr []T, fn func(accumulator, current T) T, initial T) T
Reduce executes a user-supplied "reducer" callback function on each element of the array, in order, passing in the return value from the calculation on the preceding element. The final result of running the reducer across all elements of the array is a single value.
func ReduceRight ¶
func ReduceRight[T any](arr []T, fn func(accumulator, current T) T, initial T) T
ReduceRight is the same as Reduce, but reduces the array from right to left.
func ToReserved ¶
func ToReserved[T any](arr []T) []T