MCPcopy Create free account
hub / github.com/devfile/api / Booleans

Method Booleans

pkg/attributes/attributes.go:269–280  ·  view source on GitHub ↗

Booleans allows returning only the attributes whose content is a JSON boolean. An optional error holder can be passed as an argument to receive any error that might have be raised during the attribute decoding

(errorHolder *error)

Source from the content-addressed store, hash-verified

267// to receive any error that might have be raised during the attribute
268// decoding
269func (attributes Attributes) Booleans(errorHolder *error) map[string]bool {
270 result := map[string]bool{}
271 for key := range attributes {
272 // Here only the last error is returned.
273 // Let's keep it simple and avoid adding a dependency
274 // on an external package just for gathering errors
275 if value, isRightType := attributes.Get(key, errorHolder).(bool); isRightType {
276 result[key] = value
277 }
278 }
279 return result
280}
281
282// Into allows decoding the whole attributes map
283// into a given interface. The provided interface should be either a pointer

Callers 1

TestDecodeAttributesFunction · 0.80

Calls 1

GetMethod · 0.95

Tested by 1

TestDecodeAttributesFunction · 0.64