...

Source file src/github.com/thoas/go-funk/without.go

Documentation: github.com/thoas/go-funk

     1  package funk
     2  
     3  import "reflect"
     4  
     5  // Without creates an array excluding all given values.
     6  func Without(in interface{}, values ...interface{}) interface{} {
     7  	if !IsCollection(in) {
     8  		panic("First parameter must be a collection")
     9  	}
    10  
    11  	inValue := reflect.ValueOf(in)
    12  	for _, value := range values {
    13  		if NotEqual(inValue.Type().Elem(), reflect.TypeOf(value)) {
    14  			panic("Values must have the same type")
    15  		}
    16  	}
    17  
    18  	return LeftJoin(inValue, reflect.ValueOf(values)).Interface()
    19  }
    20  

View as plain text