ParseBool extracts a boolean value from a map[string]any by key. Returns false if the map is nil, the key is absent, or the value is not a bool.
(m map[string]any, key string)
| 116 | // ParseBool extracts a boolean value from a map[string]any by key. |
| 117 | // Returns false if the map is nil, the key is absent, or the value is not a bool. |
| 118 | func ParseBool(m map[string]any, key string) bool { |
| 119 | if m == nil { |
| 120 | return false |
| 121 | } |
| 122 | if v, ok := m[key]; ok { |
| 123 | b, _ := v.(bool) |
| 124 | return b |
| 125 | } |
| 126 | return false |
| 127 | } |
| 128 | |
| 129 | // ConvertToFloat safely converts any value to float64, returning 0 on failure. |
| 130 | // |
no outgoing calls