File: types.go

package info (click to toggle)
golang-gopkg-h2non-filetype.v1 1.0.5%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: buster, buster-backports
  • size: 172 kB
  • sloc: makefile: 4
file content (18 lines) | stat: -rw-r--r-- 301 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
}