exists.go raw

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