Skip to content

Commit

Permalink
fix(#108): add application file matchers
Browse files Browse the repository at this point in the history
  • Loading branch information
h2non committed Nov 21, 2021
1 parent 7fafb18 commit 49bacff
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions kind.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,17 @@ func IsDocument(buf []byte) bool {
return kind != types.Unknown
}

// Application tries to match a file as an application type
func Application(buf []byte) (types.Type, error) {
return doMatchMap(buf, matchers.Application)
}

// IsApplication checks if the given buffer is an application type
func IsApplication(buf []byte) bool {
kind, _ := Application(buf)
return kind != types.Unknown
}

func doMatchMap(buf []byte, machers matchers.Map) (types.Type, error) {
kind := MatchMap(buf, machers)
if kind != types.Unknown {
Expand Down

0 comments on commit 49bacff

Please sign in to comment.