flatten.go
func countScalars(input []interface{}) int {
	for i := 0; i < len(input); i++ {
		switch input[i].(type) {
		case keyvalser:
			return i
		}
	}
	return len(input)
}
func countScalars(input []interface{}) int {
	for i := 0; i < len(input); i++ {
		switch input[i].(type) {
		case keyvalser:
			return i
		}
	}
	return len(input)
}
func countScalars ( input [ ] interface { } ) int { for i := 0 ; i < len ( input ) ; i ++ { switch input [ i ] . ( type ) { case keyvalser : return i } } return len ( input ) }
// countScalars returns the count of items in input up to but
// not including the first non-scalar item. A scalar is a single
// value item, ie not a keyvalser.
countScalars returns the count of items in input up to but not including the first non - scalar item . A scalar is a single value item ie not a keyvalser .