initial commit - from neko open source repository..

This commit is contained in:
Miroslav Šedivý 2020-10-22 16:54:50 +02:00
commit 56de805f54
66 changed files with 5498 additions and 0 deletions

24
internal/utils/array.go Normal file
View file

@ -0,0 +1,24 @@
package utils
import (
"reflect"
)
func ArrayIn(val interface{}, array interface{}) (exists bool, index int) {
exists = false
index = -1
switch reflect.TypeOf(array).Kind() {
case reflect.Slice:
s := reflect.ValueOf(array)
for i := 0; i < s.Len(); i++ {
if reflect.DeepEqual(val, s.Index(i).Interface()) == true {
index = i
exists = true
return
}
}
}
return
}