stop overriding false txt
This commit is contained in:
parent
8002117b0a
commit
d80ad93a17
|
|
@ -102,9 +102,7 @@ type FlexBool struct {
|
|||
// UnmarshalJSON method converts armed/disarmed, yes/no, active/inactive or 0/1 to true/false.
|
||||
// Really it converts ready, ok, up, t, armed, yes, active, enabled, 1, true to true. Anything else is false.
|
||||
func (f *FlexBool) UnmarshalJSON(b []byte) error {
|
||||
if f.Txt = strings.Trim(string(b), `"`); f.Txt == "" {
|
||||
f.Txt = "false"
|
||||
}
|
||||
f.Txt = strings.Trim(string(b), `"`)
|
||||
f.Val = f.Txt == "1" || strings.EqualFold(f.Txt, "true") || strings.EqualFold(f.Txt, "yes") ||
|
||||
strings.EqualFold(f.Txt, "t") || strings.EqualFold(f.Txt, "armed") || strings.EqualFold(f.Txt, "active") ||
|
||||
strings.EqualFold(f.Txt, "enabled") || strings.EqualFold(f.Txt, "ready") || strings.EqualFold(f.Txt, "up") ||
|
||||
|
|
|
|||
Loading…
Reference in New Issue