Skip to content

Commit

Permalink
close #23; Add IsUnknown function
Browse files Browse the repository at this point in the history
  • Loading branch information
mileusna committed Sep 16, 2023
1 parent 905f16a commit b781054
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions is.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,9 @@ func (ua UserAgent) IsTwitterbot() bool {
func (ua UserAgent) IsFacebookbot() bool {
return ua.Name == FacebookExternalHit
}

// IsUnknown returns true if the package can't determine the user agent reliably.
// Fields like Name, OS, etc. might still have values.
func (ua UserAgent) IsUnknown() bool {
return !ua.Mobile && !ua.Tablet && !ua.Desktop && !ua.Bot
}

0 comments on commit b781054

Please sign in to comment.