cast icon indicating copy to clipboard operation
cast copied to clipboard

Add helper functions for checking data types

Open bluetechy opened this issue 5 years ago • 0 comments

I like your project a lot. Although I know this project is dedicated to cast variables from one data type to another, it would be nice to have some helper functions to simplify the checking of a variable's data type such as the following function:

func IsArray(v interface{}) bool {
	rv := reflect.ValueOf(v)
	return rv.Kind() == reflect.Array || rv.Kind() == reflect.Slice
}

bluetechy avatar Jun 13 '19 04:06 bluetechy