From f6216a8b16ad4061e30bd2f3e789b298ac4d0bec Mon Sep 17 00:00:00 2001 From: mileusna Date: Wed, 16 Aug 2017 18:15:07 +0200 Subject: [PATCH] Update doc --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index df86f92..1fdb11e 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,24 @@ func main() { ``` +## Shorthand functions + +Beside `UserAgent{}` struct and its properties returned by `ua.Parse()`, there is a bunch of shorthand functions for most popular browsers and operating systems, so this code: + +```go + ua := ua.Parse(userAgentString) + if ua.OS == "Android" && ua.Name == "Chrome" { + // do something + } +``` +can be also written on this way: +```go + ua := ua.Parse(userAgentString) + if ua.IsAndroid() && ua.IsChrome() { + // do something + } +``` + ## Notice + Opera and Opera Mini are two browsers, since they operate on very different ways.