From 805729e4f74836b91cc3726b075f966409740f1a Mon Sep 17 00:00:00 2001 From: mfarah Date: Tue, 6 Oct 2015 09:25:55 +1100 Subject: [PATCH] DRYd code --- data_navigator.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/data_navigator.go b/data_navigator.go index 1dd172d8..41e8edcd 100644 --- a/data_navigator.go +++ b/data_navigator.go @@ -20,10 +20,7 @@ func write(context map[interface{}]interface{}, head string, tail []string, valu func readMap(context map[interface{}]interface{}, head string, tail []string) interface{} { value := context[head] - if len(tail) > 0 { - return recurse(value, tail[0], tail[1:len(tail)]) - } - return value + return calculateValue(value, tail) } func recurse(value interface{}, head string, tail []string) interface{} { @@ -50,10 +47,8 @@ func readArray(array []interface{}, head int64, tail []string) interface{} { } value := array[head] - if len(tail) > 0 { - return recurse(value, tail[0], tail[1:len(tail)]) - } - return value + + return calculateValue(value, tail) } func readArraySplat(array []interface{}, tail []string) interface{} {