Skip to content

s1s1ty/goin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

goin

Go Report Card Build Status license GoDoc

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

Installation and Usage

Install the package with:

go get github.com/s1s1ty/goin

Import it with:

import "github.com/s1s1ty/goin"

Quick Start

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
}

Available Methods

  • In(arr interface{})
  • InKey(arr interface{})

License

Licenced under MIT Licence
Any Suggestions and Bug Report will be gladly appreciated.