fix (helper): splitArray helper does not return emtpy string

This commit is contained in:
Pierre Roullon 2017-06-22 13:35:19 +02:00 committed by Pierre Roullon
parent 8a25e9ba06
commit 80a62f29d8

View File

@ -40,7 +40,14 @@ var ProtoHelpersFuncMap = template.FuncMap{
return string(a)
},
"splitArray": func(sep string, s string) []string {
return strings.Split(s, sep)
var r []string
t := strings.Split(s, sep)
for i := range t {
if t[i] != "" {
r = append(r, t[i])
}
}
return r
},
"first": func(a []string) string {
return a[0]