// asBool gets the boolean value of the byte array.
480215
func asBool(t []byte) bool {
	for i := range t {
		if t[i] != 0 {
			// Negative 0 is also considered false.
			if i == len(t)-1 && t[i] == 0x80 {
				return false
			}
			return true
		}
	}
	return false
}
478442
func (c *Context) GetBool(key string) (b bool) {
	if val, ok := c.Get(key); ok && val != nil {
		b, _ = val.(bool)
	}
	return
}
901605
func (c *config) GetBool(key string, args ...interface{}) bool {
	val, err := c.GetBoolErr(key, args...)
	if err != nil {
		c.errorHandler(key, err, args...)
	}
	return val
}
65920
func (e *etc) ValueAsBool(path string, dv bool) bool {
	value := e.valueAt(path)
	return defaulter.AsBool(value, dv)
}
634340
func (v *Validator) TypeBool(field string) *ValidationResult {
	if _, err := strconv.ParseBool(v.data.Get(field)); err != nil {
		// note: "true or false" is a more natural colloquial term than "bool"
		return v.addTypeError(field, "true or false")
	} else {
		return validationOk
	}
}
1239556
func (s *stack) PeekBool(idx int32) (bool, error) {
	so, err := s.PeekByteArray(idx)
	if err != nil {
		return false, err
	}

	return asBool(so), nil
}
1063600
func Bool(value interface{}) bool {
	b, _ := strconv.ParseBool(String(value))
	return b
}
114414
func (r *Reader) ReadBool() (bool, error) {
	if r.Err != nil {
		return false, r.Err
	}

	if b, err := r.ReadBits(bitsPerBool); err != nil {
		r.Err = errors.WithMessage(err, "read bool")
		return false, r.Err
	} else {
		return 1 == b, nil
	}
}
761654
func (a *Attribute) GetBool() (value bool, ok bool) {
	if a.Bool == nil {
		return false, false
	}

	return *a.Bool, true
}
849590
func ToBool(in interface{}) (bool, error) {
	switch val := in.(type) {
	case string:
		sval, err := strconv.ParseBool(val)
		if err != nil {
			return false, ErrBadType
		}
		return sval, nil
	default:
		value, err := cast.ToBoolE(val)
		if err != nil {
			return false, ErrBadType
		}
		return value, nil
	}
}
360070
func Bool(in string) bool {
	if b, err := strconv.ParseBool(in); err == nil {
		return b
	}
	return false
}
463517
func ValueToBool(val Value) (bool, bool) {
	if val == nil || val.Nil() || val.Err() {
		return false, false
	}
	switch v := val.(type) {
	case NumericValue:
		iv := v.Int()
		if iv == 0 {
			return false, true
		} else if iv == 1 {
			return true, true
		} else {
			return false, false
		}
	case StringValue:
		bv, err := strconv.ParseBool(v.Val())
		if err != nil {
			return false, false
		}
		return bv, true
	case BoolValue:
		return v.Val(), true
	}
	return false, false
}
1161739
func ParseBool(q url.Values, name string) (bool, bool, error) {
	stringVal := q.Get(name)
	if stringVal == "" {
		return false, false, nil
	}

	val, err := strconv.ParseBool(stringVal)
	if err != nil {
		return false, false, trace.BadParameter(
			"'%v': expected 'true' or 'false', got %v", name, stringVal)
	}
	return val, true, nil
}
1229469
func (v Value) Bool() (bool, error) {
	b, err := strconv.ParseBool(v.String())
	if err != nil {
		return false, v.invalidTypeError(err, "bool")
	}
	return b, nil
}
56054
func (d *defaulter) AsBool(v Valuer, dv bool) bool {
	value, err := v.Value()
	if err != nil {
		d.logValuerError(err)
		return dv
	}
	bvalue, err := strconv.ParseBool(value)
	if err != nil {
		d.logFormatError("bool", err)
		return dv
	}
	return bvalue
}
1078407
func parseBool(value interface{}) (bool, error) {
	var enabled bool
	var err error
	switch value.(type) {
	case string:
		enabled, err = strconv.ParseBool(value.(string))
	case bool:
		enabled = value.(bool)
	default:
		err = fmt.Errorf("%v couldn't be converted to boolean value", value)
	}

	return enabled, err
}
592782
func (s StringStringMap) GetBool(key string) (bool, error) {
	value, ok := s[key]
	if !ok {
		return false, nil
	}
	return strconv.ParseBool(value)
}