Some
Overview
Some reports whether fn is true for any element (Array.some).
If you are coming from Node.js, the closest pattern is arr.some(fn).
Signature
go
func Some[T any](in []T, fn func(T) bool) boolCompare: Node.js · Standard Go · gox
js
arr.some(fn)go
// Manual loop or Go 1.21+ slices package
for _, v := range items {
// transform or filter v
}go
import "github.com/sahilkhaire/gox/slice"
slice.Some(arr, fn)Example
go
import "github.com/sahilkhaire/gox/slice"
slice.Some(arr, fn)Tips
Chain Filter, Map, and Reduce for lodash-style pipelines. Results are new slices — inputs are never mutated.
Standard library alternative
Use a for loop or Go 1.21+ slices package helpers from the standard library.