Documentation
¶
Index ¶
- func AnyWithin[V comparable, S ~[]V](src S, others ...S) (present bool)
- func Append[V comparable, S ~[]V](src S, values ...V) (modified S)
- func Copy[V interface{}, S ~[]V](slice S) (copied S)
- func DuplicateCounts[V comparable, S ~[]V](src S) (counts map[V]int)
- func Equal[V comparable, S ~[]V](src S, others ...S) (same bool)
- func IndexOf[V comparable, S ~[]V](slice S, value V) (index int)
- func IndexesOf[V comparable, S ~[]V](slice S, value V) (indexes []int)
- func Insert[V interface{}, S ~[]V](slice S, at int, values ...V) (modified S)
- func Merge[V comparable, S ~[]V](src S, others ...S) (modified S)
- func Pop[V interface{}, S ~[]V](slice S) (modified S, value V)
- func Present[V comparable](search V, others ...V) (present bool)
- func Prune[V comparable, S ~[]V](slice S, value V) (modified S)
- func Push[V interface{}, S ~[]V](slice S, values ...V) (modified S)
- func Remove[V interface{}, S ~[]V](slice S, at int) (modified S)
- func Retype[T interface{}](src []interface{}) (slice []T, ok bool)
- func Shift[V interface{}, S ~[]V](slice S, values ...V) (modified S)
- func StartsWith[V comparable, S ~[]V](src S, others ...S) (same bool)
- func ToCamels(list []string) (camel []string)
- func ToKebabs(list []string) (kebabs []string)
- func ToScreamingKebabs(list []string) (screamingKebabs []string)
- func ToScreamingSnakes(list []string) (screamingSnakes []string)
- func ToSnakes(list []string) (snakes []string)
- func Truncate[V interface{}, S ~[]V](slice S, length int) (truncated S)
- func Unique[V comparable, S ~[]V](src S) (unique S)
- func Unshift[V interface{}, S ~[]V](slice S) (modified S, value V)
- func Within[V comparable, S ~[]V](search V, others ...S) (present bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnyWithin ¶
func AnyWithin[V comparable, S ~[]V](src S, others ...S) (present bool)
AnyWithin returns true if any of the values in the source given are present in any of the other slices given
func Append ¶ added in v0.5.0
func Append[V comparable, S ~[]V](src S, values ...V) (modified S)
Append returns a new slice appended with only values not within the src slice
func Copy ¶
func Copy[V interface{}, S ~[]V](slice S) (copied S)
Copy creates a new slice (array) from the given slice
func DuplicateCounts ¶ added in v0.5.6
func DuplicateCounts[V comparable, S ~[]V](src S) (counts map[V]int)
DuplicateCounts returns a mapping of values and their respective counts, distinct values not included
func Equal ¶ added in v0.5.0
func Equal[V comparable, S ~[]V](src S, others ...S) (same bool)
Equal returns true if all the slices given have the same values
func IndexOf ¶
func IndexOf[V comparable, S ~[]V](slice S, value V) (index int)
IndexOf returns the first index matching the value given
func IndexesOf ¶
func IndexesOf[V comparable, S ~[]V](slice S, value V) (indexes []int)
IndexesOf returns a list of all indexes matching the value given
func Insert ¶
func Insert[V interface{}, S ~[]V](slice S, at int, values ...V) (modified S)
Insert creates a new slice (array) from the given slice, with additional values inserted at the given index
func Merge ¶ added in v0.5.0
func Merge[V comparable, S ~[]V](src S, others ...S) (modified S)
Merge returns a new slice with the new values found within others appended to the src slice
func Pop ¶
func Pop[V interface{}, S ~[]V](slice S) (modified S, value V)
Pop removes the last value from a Copy of the slice and returns it
func Present ¶
func Present[V comparable](search V, others ...V) (present bool)
Present returns true if the search value is present in any of the other values given
func Prune ¶
func Prune[V comparable, S ~[]V](slice S, value V) (modified S)
Prune removes all instances of the specified value from a copy of the given slice
func Push ¶
func Push[V interface{}, S ~[]V](slice S, values ...V) (modified S)
Push appends the given value to a new copy of the given slice
func Remove ¶
func Remove[V interface{}, S ~[]V](slice S, at int) (modified S)
Remove creates a new slice (array) from the given slice, with the specified index removed
func Shift ¶
func Shift[V interface{}, S ~[]V](slice S, values ...V) (modified S)
Shift prepends the given value to a new copy of the given slice
func StartsWith ¶ added in v0.5.0
func StartsWith[V comparable, S ~[]V](src S, others ...S) (same bool)
StartsWith returns true if the other slices given start with the same values as the src
func ToScreamingKebabs ¶ added in v0.5.0
func ToScreamingSnakes ¶ added in v0.5.0
func Truncate ¶
func Truncate[V interface{}, S ~[]V](slice S, length int) (truncated S)
Truncate creates a new slice (array), of specified length, from the given slice
func Unique ¶ added in v0.5.6
func Unique[V comparable, S ~[]V](src S) (unique S)
Unique returns a new slice with duplicate values omitted, maintaining order
func Unshift ¶
func Unshift[V interface{}, S ~[]V](slice S) (modified S, value V)
Unshift removes the first value from a Copy of the slice and returns it
func Within ¶
func Within[V comparable, S ~[]V](search V, others ...S) (present bool)
Within return true if the search value is present in any of the other slices of V given
Types ¶
This section is empty.