MCPcopy Create free account
hub / github.com/github/gh-aw / ParseBool

Function ParseBool

pkg/typeutil/convert.go:118–127  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
118func 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//

Callers 3

parseBoolFromFrontmatterFunction · 0.92
ParseBoolFromConfigFunction · 0.92

Calls

no outgoing calls

Tested by 1