utils.go: added IsBool() and IsFract()

This commit is contained in:
2024-05-10 04:48:13 +02:00
parent c3198e4c79
commit 9c2eca40d7
+10
View File
@@ -24,6 +24,11 @@ func IsFloat(v any) (ok bool) {
return ok
}
func IsBool(v any) (ok bool) {
_, ok = v.(bool)
return ok
}
func IsList(v any) (ok bool) {
_, ok = v.(*ListType)
return ok
@@ -34,6 +39,11 @@ func IsDict(v any) (ok bool) {
return ok
}
func IsFract(v any) (ok bool) {
_, ok = v.(*fraction)
return ok
}
func IsNumber(v any) (ok bool) {
return IsFloat(v) || IsInteger(v)
}