mirror of
https://github.com/br0xen/termbox-screen.git
synced 2024-11-22 13:33:14 +00:00
29 lines
473 B
Go
29 lines
473 B
Go
|
package termboxScreen
|
||
|
|
||
|
type Bundle map[string]interface{}
|
||
|
|
||
|
func (b Bundle) SetValue(key string, val interface{}) {
|
||
|
b[key] = val
|
||
|
}
|
||
|
|
||
|
func (b Bundle) GetBool(key string, def bool) bool {
|
||
|
if v, ok := b[key].(bool); ok {
|
||
|
return v
|
||
|
}
|
||
|
return def
|
||
|
}
|
||
|
|
||
|
func (b Bundle) GetString(key, def string) string {
|
||
|
if v, ok := b[key].(string); ok {
|
||
|
return v
|
||
|
}
|
||
|
return def
|
||
|
}
|
||
|
|
||
|
func (b Bundle) GetInt(key string, def int) int {
|
||
|
if v, ok := b[key].(int); ok {
|
||
|
return v
|
||
|
}
|
||
|
return def
|
||
|
}
|