Documentation
¶
Overview ¶
Package array provides JavaScript Array.prototype method equivalents using Go generics.
Index ¶
- func Concat[T any](slices ...[]T) []T
- func Every[T any](a []T, fn func(T, int) bool) bool
- func Filter[T any](a []T, fn func(T, int) bool) []T
- func Find[T any](a []T, fn func(T, int) bool) (T, bool)
- func FindIndex[T any](a []T, fn func(T, int) bool) int
- func Flat[T any](a [][]T) []T
- func ForEach[T any](a []T, fn func(T, int))
- func Includes[T comparable](a []T, item T) bool
- func IndexOf[T comparable](a []T, item T) int
- func Join[T any](a []T, sep string, stringer func(T) string) string
- func LastIndexOf[T comparable](a []T, item T) int
- func Map[T, U any](a []T, fn func(T, int) U) []U
- func Pop[T any](a *[]T) (T, bool)
- func Push[T any](a *[]T, items ...T) int
- func Reduce[T, U any](a []T, fn func(U, T, int) U, initial U) U
- func Reverse[T any](a []T) []T
- func Shift[T any](a *[]T) (T, bool)
- func Slice[T any](a []T, start, end int) []T
- func Some[T any](a []T, fn func(T, int) bool) bool
- func Splice[T any](a *[]T, start, deleteCount int, items ...T) []T
- func Unshift[T any](a *[]T, items ...T) int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Concat ¶
func Concat[T any](slices ...[]T) []T
Concat returns a new slice combining all input slices.
func Includes ¶
func Includes[T comparable](a []T, item T) bool
Includes returns true if the slice contains the item.
func IndexOf ¶
func IndexOf[T comparable](a []T, item T) int
IndexOf returns the first index of item, or -1.
func LastIndexOf ¶
func LastIndexOf[T comparable](a []T, item T) int
LastIndexOf returns the last index of item, or -1.
func Reverse ¶
func Reverse[T any](a []T) []T
Reverse returns a new slice with elements in reverse order.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.