exists.go 332 B

123456789
  1. package mxj
  2. // Checks whether the path exists. If err != nil then 'false' is returned
  3. // along with the error encountered parsing either the "path" or "subkeys"
  4. // argument.
  5. func (mv Map) Exists(path string, subkeys ...string) (bool, error) {
  6. v, err := mv.ValuesForPath(path, subkeys...)
  7. return (err == nil && len(v) > 0), err
  8. }