diff options
Diffstat (limited to 'frontend')
-rw-r--r-- | frontend/renderer.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/frontend/renderer.go b/frontend/renderer.go index d529dff..9c1f7a7 100644 --- a/frontend/renderer.go +++ b/frontend/renderer.go | |||
@@ -65,6 +65,15 @@ func New(path string, functions map[string]interface{}) *Renderer { | |||
65 | "makeRangePair": func(idx int, value interface{}) RangePair { | 65 | "makeRangePair": func(idx int, value interface{}) RangePair { |
66 | return RangePair{idx, value} | 66 | return RangePair{idx, value} |
67 | }, | 67 | }, |
68 | "map": func(values ...interface{}) map[string]interface{} { | ||
69 | m := make(map[string]interface{}, len(values)/2) | ||
70 | for i := 0; i < len(values); i += 2 { | ||
71 | key, _ := values[i].(string) | ||
72 | m[key] = values[i+1] | ||
73 | } | ||
74 | |||
75 | return m | ||
76 | }, | ||
68 | "makeObject": func(name string, existing interface{}, newKey string, newData interface{}) map[string]interface{} { | 77 | "makeObject": func(name string, existing interface{}, newKey string, newData interface{}) map[string]interface{} { |
69 | d := make(map[string]interface{}) | 78 | d := make(map[string]interface{}) |
70 | d[name] = existing | 79 | d[name] = existing |