refactored data-types to reduce plugin sizes

This commit is contained in:
2026-06-08 07:02:56 +02:00
parent fec7cc546c
commit b6da9bcad4
90 changed files with 1039 additions and 803 deletions
+34
View File
@@ -0,0 +1,34 @@
// Copyright (c) 2024-2026 Celestino Amoroso (celestino.amoroso@gmail.com).
// All rights reserved.
// bool.go
package boolean
func IsBool(v any) (ok bool) {
_, ok = v.(bool)
return ok
}
// func (b *bool) EqualTo(other kern.Equaler) (equal bool) {
// if otherBool, ok := other.(*bool); ok {
// equal = b == otherBool
// }
// return
// }
func ToBool(v any) (b bool, ok bool) {
ok = true
switch x := v.(type) {
case string:
b = len(x) > 0
case float64:
b = x != 0.0
case int64:
b = x != 0
case bool:
b = x
default:
ok = false
}
return
}