Skip to content

Commit

Permalink
add GetAsSimpleYaml function
Browse files Browse the repository at this point in the history
  • Loading branch information
GorillaJulz committed Apr 18, 2017
1 parent e9ad1bb commit 2dbb4d4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions goml/goml.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ func Get(yml *simpleyaml.Yaml, path string) (interface{}, error) {
return result, err
}

func GetAsSimpleYaml(yml *simpleyaml.Yaml, path string) (*simpleyaml.Yaml, error) {
val, ok := get(yml, path)
if ok == nil {
return nil, errors.New("property not found")
}

return val, nil
}

func ExtractType(value *simpleyaml.Yaml) (interface{}, error) {
if v, err := value.String(); err == nil {
return v, nil
Expand Down

0 comments on commit 2dbb4d4

Please sign in to comment.