1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-13 09:12:28 +08:00

Slice: Add none func (#13)

Returns true whether no elements of this slice match the provided predicate
func. Negated form of Every func
This commit is contained in:
donutloop
2022-01-05 12:38:14 +01:00
committed by GitHub
parent 4752725dd6
commit 4aef9d6d22
4 changed files with 36 additions and 0 deletions

View File

@@ -394,6 +394,7 @@ func Difference(slice1, slice2 interface{}) interface{} //creates an slice of wh
func DeleteByIndex(slice interface{}, start int, end ...int) (interface{}, error) //delete the element of slice from start index to end index - 1
func Drop(slice interface{}, n int) interface{} //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(slice, function interface{}) bool //return true if all of the values in the slice pass the predicate function, function signature should be func(index int, value interface{}) bool
func None(slice, function interface{}) bool // return true if all the values in the slice mismatch the criteria
func Filter(slice, function interface{}) interface{} //filter slice, function signature should be func(index int, value interface{}) bool
func Find(slice, function interface{}) (interface{}, bool) //iterates over elements of slice, returning the first one that passes a truth test on function.function signature should be func(index int, value interface{}) bool .
func FlattenDeep(slice interface{}) interface{} //flattens slice recursive