3
0
corteza/pkg/qlng/util.go
Tomaž Jerman 25a9be1a54 Refactor pkg/ql for more flexibility
Created a temporary pkg/qlng package which contains the reworked
logic to avoid (potentially) breaking the rest of the system.

Most of the testing will be done implicitly via reporting tests.
2021-08-16 09:16:07 +02:00

21 lines
353 B
Go

package qlng
import (
"regexp"
"strings"
)
var (
truthy = regexp.MustCompile(`^(t(rue)?|y(es)?|1)$`)
)
// Check what boolean value the given string conforms to
func evalBool(v string) bool {
return truthy.MatchString(strings.ToLower(v))
}
// Check if the given string is a float
func isFloaty(v string) bool {
return strings.Contains(v, ".")
}