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.
21 lines
353 B
Go
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, ".")
|
|
}
|