mirror of
https://github.com/duke-git/lancet.git
synced 2026-02-14 01:32:27 +08:00
rename: rename InsertByIndex -> InsertAt, UpdateByIndex -> UpdateAt, DeleteByIndex -> DeleteAt for release 2.0
This commit is contained in:
@@ -440,7 +440,7 @@ func Concat[T any](slice []T, values ...[]T) []T //creates a new slice concatena
|
||||
func Difference[T comparable](slice1, slice2 []T) []T //creates an slice of whose element not included in the other given slice
|
||||
func DifferenceBy[T any](slice []T, comparedSlice []T, iteratee func(index int, t T) T) []T //it accepts iteratee which is invoked for each element of slice and values to generate the criterion by which they're compared.
|
||||
func DifferenceWith[T any](slice []T, comparedSlice []T, comparator func(value, otherValue T) bool) []T //accepts comparator which is invoked to compare elements of slice to values. The order and references of result values are determined by the first slice.
|
||||
func DeleteByIndex[T any](slice []T, start int, end ...int) []T //delete the element of slice from start index to end index - 1
|
||||
func DeleteAt[T any](slice []T, start int, end ...int) []T //delete the element of slice from start index to end index - 1
|
||||
func Drop[T any](slice []T, n int) []T //creates a slice with `n` elements dropped from the beginning when n > 0, or `n` elements dropped from the ending when n < 0
|
||||
func Every[T any](slice []T, predicate func(index int, t T) bool) bool //return true if all of the values in the slice pass the predicate function
|
||||
func None[T any](slice []T, predicate func(index int, t T) bool) bool // return true if all the values in the slice mismatch the criteria
|
||||
@@ -452,7 +452,7 @@ func ForEach [T any] (slice []T, iteratee func(index int, t T)) //iterates over
|
||||
func IntSlice(slice interface{}) ([]int, error) //convert value to int slice
|
||||
func InterfaceSlice(slice interface{}) []interface{} //convert value to interface{} slice
|
||||
func Intersection[T comparable](slices ...[]T) []T //creates a slice of unique values that included by all slices.
|
||||
func InsertByIndex[T any](slice []T, index int, value interface{}) []T //insert the value or other slice into slice at index.
|
||||
func InsertAt[T any](slice []T, index int, value interface{}) []T //insert the value or other slice into slice at index.
|
||||
func Map [T any, U any] (slice []T, iteratee func(index int, t T) U) []U //creates an slice of values by running each element of slice thru iteratee function.
|
||||
func Reverse[T any](slice []T)//revere slice
|
||||
func Reduce[T any](slice []T, iteratee func(index int, t1, t2 T) T, initial T) T //creates an slice of values by running each element of slice thru iteratee function
|
||||
@@ -462,7 +462,7 @@ func Some[T any](slice []T, predicate func(index int, t T) bool) bool //return t
|
||||
func StringSlice(slice interface{}) []string //convert value to string slice
|
||||
func Unique[T comparable](slice []T) []T //remove duplicate elements in slice
|
||||
func Union[T comparable](slices ...[]T) []T //Union creates a slice of unique values, in order, from all given slices. using == for equality comparisons.
|
||||
func UpdateByIndex[T any](slice []T, index int, value T) []T //update the slice element at index.
|
||||
func UpdateAt[T any](slice []T, index int, value T) []T //update the slice element at index.
|
||||
func Without[T comparable](slice []T, values ...T) []T //creates a slice excluding all given values
|
||||
func GroupBy[T any](slice []T, groupFn func(index int, t T) bool) ([]T, []T) //iterate over elements of the slice, each element will be group by criteria, returns two slices
|
||||
func Count[T any](slice []T, predicate func(index int, t T) bool) int // iterates over elements of slice, returns a count of all matched elements
|
||||
|
||||
Reference in New Issue
Block a user