Skip to content

Commit 2dbb4d4

Browse files
committed
add GetAsSimpleYaml function
1 parent e9ad1bb commit 2dbb4d4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

goml/goml.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ func Get(yml *simpleyaml.Yaml, path string) (interface{}, error) {
2121
return result, err
2222
}
2323

24+
func GetAsSimpleYaml(yml *simpleyaml.Yaml, path string) (*simpleyaml.Yaml, error) {
25+
val, ok := get(yml, path)
26+
if ok == nil {
27+
return nil, errors.New("property not found")
28+
}
29+
30+
return val, nil
31+
}
32+
2433
func ExtractType(value *simpleyaml.Yaml) (interface{}, error) {
2534
if v, err := value.String(); err == nil {
2635
return v, nil

0 commit comments

Comments
 (0)