aicra/internal/checker/builtin/bool.go

24 lines
469 B
Go
Raw Normal View History

package builtin
import "git.xdrm.io/go/aicra/internal/checker"
// Bool checks if a value is a boolean
type Bool struct{}
// NewBool returns a bare boolean type checker
func NewBool() *Bool {
return &Bool{}
}
// Checker returns the checker function
func (Bool) Checker(typeName string) checker.Checker {
// nothing if type not handled
if typeName != "bool" {
return nil
}
return func(value interface{}) bool {
_, isBool := value.(bool)
return isBool
}
}