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 authored and GitHub committed 2022-01-05 19:38:14 +08:00
1 parent 4752725dd6
commit 4aef9d6d22
4 files changed
+36

No files matched your search

+1
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