From d518f085ae65a4d1be1c44ea8a83e21277904eac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milo=C5=A1=20Mileusni=C4=87?= Date: Sat, 30 Jul 2022 11:55:13 +0200 Subject: [PATCH] Update README --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 32fe88d..7ba1eed 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Go/Golang package for parsing user agent strings [![GoDoc](https://godoc.org/github.com/mileusna/useragent?status.svg)](https://godoc.org/github.com/mileusna/useragent) -Package `ua.Parse(userAgent string)` function parses browser's and bot's user agents strings and determins: +Use `useragent.Parse(userAgent string)` function to parse browser's and bot's user agents strings and get: + User agent name and version (Chrome, Firefox, Googlebot, etc.) + Operating system name and version (Windows, Android, iOS etc.) + Device type (mobile, desktop, tablet, bot) @@ -27,7 +27,7 @@ import ( "fmt" "strings" - ua "github.com/mileusna/useragent" + "github.com/mileusna/useragent" ) func main() { @@ -44,7 +44,7 @@ func main() { } for _, s := range userAgents { - ua := ua.Parse(s) + ua := useragent.Parse(s) fmt.Println() fmt.Println(ua.String) fmt.Println(strings.Repeat("=", len(ua.String))) @@ -74,17 +74,17 @@ 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: +Beside `UserAgent{}` struct and its properties returned by `useragent.Parse()`, there is a bunch of shorthand functions for most popular browsers and operating systems, so this code: ```go - ua := ua.Parse(userAgentString) + ua := useragent.Parse(userAgentString) if ua.OS == "Android" && ua.Name == "Chrome" { // do something } ``` can be also written on this way: ```go - ua := ua.Parse(userAgentString) + ua := useragent.Parse(userAgentString) if ua.IsAndroid() && ua.IsChrome() { // do something }