stringFromMap returns the first non-empty string value found for any of the given keys in the JSON map. Numbers and booleans are ignored — DescribeCall is for showing human-readable identifiers.
(m map[string]json.RawMessage, keys []string)
| 74 | // of the given keys in the JSON map. Numbers and booleans are ignored |
| 75 | // — DescribeCall is for showing human-readable identifiers. |
| 76 | func stringFromMap(m map[string]json.RawMessage, keys []string) string { |
| 77 | for _, k := range keys { |
| 78 | if raw, ok := m[k]; ok { |
| 79 | var s string |
| 80 | if err := json.Unmarshal(raw, &s); err == nil && s != "" { |
| 81 | return s |
| 82 | } |
| 83 | } |
| 84 | } |
| 85 | return "" |
| 86 | } |
| 87 | |
| 88 | // jsonString is the shorthand used by atomic-tool plugins (@read, |
| 89 | // @search, @tree, @todo, …) that own the parsed JSON object directly. |
no outgoing calls
no test coverage detected