code: func index(l []interface{}, valToLookUp interface{}, mergeKey string, kind reflect.Kind) int {
  	var getValFn func(interface{}) interface{}
  	// Get the correct `getValFn` based on item `kind`.
  	// It should return the value of merge key for maps and
  	// return the item for other kinds.
  	switch kind {
  	case reflect.Map:
  		getValFn = func(item interface{}) interface{} {
  			typedItem, ok := item.(map[string]interface{})
  			if !ok {
  				return nil
  			}
  			val := typedItem[mergeKey]
  			return val
  		}
  	default:
  		getValFn = func(item interface{}) interface{} {
  			return item
  		}
  	}
  
  	for i, v := range l {
  		if getValFn(valToLookUp) == getValFn(v) {
  			return i
  		}
  	}
  	return -1
  }
docs: // index returns the index of the item in the given items, or -1 if it doesn't exist
  // l must NOT be a slice of slices, this should be checked before calling.