Skip to content

Commit 805729e

Browse files
author
mfarah
committed
DRYd code
1 parent 7db3100 commit 805729e

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

data_navigator.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@ func write(context map[interface{}]interface{}, head string, tail []string, valu
2020

2121
func readMap(context map[interface{}]interface{}, head string, tail []string) interface{} {
2222
value := context[head]
23-
if len(tail) > 0 {
24-
return recurse(value, tail[0], tail[1:len(tail)])
25-
}
26-
return value
23+
return calculateValue(value, tail)
2724
}
2825

2926
func recurse(value interface{}, head string, tail []string) interface{} {
@@ -50,10 +47,8 @@ func readArray(array []interface{}, head int64, tail []string) interface{} {
5047
}
5148

5249
value := array[head]
53-
if len(tail) > 0 {
54-
return recurse(value, tail[0], tail[1:len(tail)])
55-
}
56-
return value
50+
51+
return calculateValue(value, tail)
5752
}
5853

5954
func readArraySplat(array []interface{}, tail []string) interface{} {

0 commit comments

Comments
 (0)