package jmespath

import (
	
	
)
IsFalse determines if an object is false based on the JMESPath spec. JMESPath defines false values to be any of: - An empty string array, or hash. - The boolean value false. - nil
func ( interface{}) bool {
	switch v := .(type) {
	case bool:
		return !
	case []interface{}:
		return len() == 0
	case map[string]interface{}:
		return len() == 0
	case string:
		return len() == 0
	case nil:
		return true
Try the reflection cases before returning false.
	 := reflect.ValueOf()
	switch .Kind() {
A struct type will never be false, even if all of its values are the zero type.
		return false
	case reflect.Slice, reflect.Map:
		return .Len() == 0
	case reflect.Ptr:
		if .IsNil() {
			return true
If it's a pointer type, we'll try to deref the pointer and evaluate the pointer value for isFalse.
		 := .Elem()
		return (.Interface())
	}
	return false
}
ObjsEqual is a generic object equality check. It will take two arbitrary objects and recursively determine if they are equal.
func ( interface{},  interface{}) bool {
	return reflect.DeepEqual(, )
}
SliceParam refers to a single part of a slice. A slice consists of a start, a stop, and a step, similar to python slices.
type sliceParam struct {
	N         int
	Specified bool
}
Slice supports [start:stop:step] style slicing that's supported in JMESPath.
func ( []interface{},  []sliceParam) ([]interface{}, error) {
	,  := computeSliceParams(len(), )
	if  != nil {
		return nil, 
	}
	, ,  := [0], [1], [2]
	 := []interface{}{}
	if  > 0 {
		for  := ;  < ;  +=  {
			 = append(, [])
		}
	} else {
		for  := ;  > ;  +=  {
			 = append(, [])
		}
	}
	return , nil
}

func ( int,  []sliceParam) ([]int, error) {
	var , ,  int
	if ![2].Specified {
		 = 1
	} else if [2].N == 0 {
		return nil, errors.New("Invalid slice, step cannot be 0")
	} else {
		 = [2].N
	}
	var  bool
	if  < 0 {
		 = true
	} else {
		 = false
	}

	if ![0].Specified {
		if  {
			 =  - 1
		} else {
			 = 0
		}
	} else {
		 = capSlice(, [0].N, )
	}

	if ![1].Specified {
		if  {
			 = -1
		} else {
			 = 
		}
	} else {
		 = capSlice(, [1].N, )
	}
	return []int{, , }, nil
}

func ( int,  int,  int) int {
	if  < 0 {
		 += 
		if  < 0 {
			if  < 0 {
				 = -1
			} else {
				 = 0
			}
		}
	} else if  >=  {
		if  < 0 {
			 =  - 1
		} else {
			 = 
		}
	}
	return 
}
ToArrayNum converts an empty interface type to a slice of float64. If any element in the array cannot be converted, then nil is returned along with a second value of false.
Is there a better way to do this with reflect?
	if ,  := .([]interface{});  {
		 := make([]float64, len())
		for ,  := range  {
			,  := .(float64)
			if ! {
				return nil, false
			}
			[] = 
		}
		return , true
	}
	return nil, false
}
ToArrayStr converts an empty interface type to a slice of strings. If any element in the array cannot be converted, then nil is returned along with a second value of false. If the input data could be entirely converted, then the converted data, along with a second value of true, will be returned.
Is there a better way to do this with reflect?
	if ,  := .([]interface{});  {
		 := make([]string, len())
		for ,  := range  {
			,  := .(string)
			if ! {
				return nil, false
			}
			[] = 
		}
		return , true
	}
	return nil, false
}

func ( interface{}) bool {
	if  == nil {
		return false
	}
	return reflect.TypeOf().Kind() == reflect.Slice