2019-05-01 09:23:05 +00:00
|
|
|
package builtin
|
|
|
|
|
2019-05-01 09:28:55 +00:00
|
|
|
import "git.xdrm.io/go/aicra/typecheck"
|
2019-05-01 09:23:05 +00:00
|
|
|
|
|
|
|
// Float64 checks if a value is a float64
|
|
|
|
type Float64 struct{}
|
|
|
|
|
|
|
|
// NewFloat64 returns a bare number type checker
|
|
|
|
func NewFloat64() *Float64 {
|
|
|
|
return &Float64{}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Checker returns the checker function
|
2019-05-01 09:28:55 +00:00
|
|
|
func (Float64) Checker(typeName string) typecheck.Checker {
|
2019-05-01 09:23:05 +00:00
|
|
|
// nothing if type not handled
|
|
|
|
if typeName != "float64" && typeName != "float" {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return func(value interface{}) bool {
|
|
|
|
_, isFloat64 := value.(bool)
|
|
|
|
return isFloat64
|
|
|
|
}
|
|
|
|
}
|