YTSFlix_Go/vendor/gopkg.in/h2non/filetype.v1/types/types.go
2018-11-04 15:58:15 +01:00

19 lines
301 B
Go

package types
var Types = make(map[string]Type)
// Add registers a new type in the package
func Add(t Type) Type {
Types[t.Extension] = t
return t
}
// Get retrieves a Type by extension
func Get(ext string) Type {
kind := Types[ext]
if kind.Extension != "" {
return kind
}
return Unknown
}