goin Evaluates to true if it finds a variable in the specified sequence and false otherwise.
- goin package is built inspired by python in operator
Install the package with:
go get github.com/s1s1ty/goin
Import it with:
import "github.com/s1s1ty/goin"
func main() {
ar := []int{1, 2, 4, 7, 8, 3}
found, _ := goin.Value(7).In(ar)
fmt.Println(found) // true
seq := []float64{1.11, 3.20, 5.89, 2.90}
found, _ = goin.Value(2.9).In(seq)
fmt.Println(found) // true
dict := map[string]string{"name": "shaon", "id": "110"}
found, _ = goin.Value("fullname").InKey(dict)
fmt.Println(found) // false
}
In(arr interface{})
InKey(arr interface{})
Licenced under MIT Licence