service/vendor/github.com/clbanning/mxj/v2/exists.go

10 lines
332 B
Go
Raw Permalink Normal View History

2023-12-21 22:17:40 +08:00
package mxj
// Checks whether the path exists. If err != nil then 'false' is returned
// along with the error encountered parsing either the "path" or "subkeys"
// argument.
func (mv Map) Exists(path string, subkeys ...string) (bool, error) {
v, err := mv.ValuesForPath(path, subkeys...)
return (err == nil && len(v) > 0), err
}