continuing compact widget refactor

This commit is contained in:
Bradley Cicenas
2019-07-05 23:05:21 +00:00
parent 8427b0c81d
commit 0ca5235ae5
9 changed files with 143 additions and 233 deletions

View File

@@ -9,7 +9,23 @@ type Log struct {
type Meta map[string]string
func NewMeta() Meta { return make(Meta) }
// NewMeta returns an initialized Meta map.
// An optional series of key, values may be provided to populate the map prior to returning
func NewMeta(kvs ...string) Meta {
m := make(Meta)
var k string
for i := 0; i < len(kvs)-1; i++ {
if k == "" {
k = kvs[i]
} else {
m[k] = kvs[i]
k = ""
}
}
return m
}
func (m Meta) Get(k string) string {
if s, ok := m[k]; ok {