git.sr.ht/~pingoo/stdx@v0.0.0-20240218134121-094174641f6e/useragent/is.go (about)

     1  package useragent
     2  
     3  // IsWindows shorthand function to check if OS == Windows
     4  func (ua UserAgent) IsWindows() bool {
     5  	return ua.OS == Windows
     6  }
     7  
     8  // IsAndroid shorthand function to check if OS == Android
     9  func (ua UserAgent) IsAndroid() bool {
    10  	return ua.OS == Android
    11  }
    12  
    13  // IsMacOS shorthand function to check if OS == MacOS
    14  func (ua UserAgent) IsMacOS() bool {
    15  	return ua.OS == MacOS
    16  }
    17  
    18  // IsIOS shorthand function to check if OS == IOS
    19  func (ua UserAgent) IsIOS() bool {
    20  	return ua.OS == IOS
    21  }
    22  
    23  // IsLinux shorthand function to check if OS == Linux
    24  func (ua UserAgent) IsLinux() bool {
    25  	return ua.OS == Linux
    26  }
    27  
    28  // IsChromeOS shorthand function to check if OS == CrOS
    29  func (ua UserAgent) IsChromeOS() bool {
    30  	return ua.OS == ChromeOS || ua.OS == "CrOS"
    31  }
    32  
    33  // IsOpera shorthand function to check if Name == Opera
    34  func (ua UserAgent) IsOpera() bool {
    35  	return ua.Name == Opera
    36  }
    37  
    38  // IsOperaMini shorthand function to check if Name == Opera Mini
    39  func (ua UserAgent) IsOperaMini() bool {
    40  	return ua.Name == OperaMini
    41  }
    42  
    43  // IsChrome shorthand function to check if Name == Chrome
    44  func (ua UserAgent) IsChrome() bool {
    45  	return ua.Name == Chrome
    46  }
    47  
    48  // IsFirefox shorthand function to check if Name == Firefox
    49  func (ua UserAgent) IsFirefox() bool {
    50  	return ua.Name == Firefox
    51  }
    52  
    53  // IsInternetExplorer shorthand function to check if Name == Internet Explorer
    54  func (ua UserAgent) IsInternetExplorer() bool {
    55  	return ua.Name == InternetExplorer
    56  }
    57  
    58  // IsSafari shorthand function to check if Name == Safari
    59  func (ua UserAgent) IsSafari() bool {
    60  	return ua.Name == Safari
    61  }
    62  
    63  // IsEdge shorthand function to check if Name == Edge
    64  func (ua UserAgent) IsEdge() bool {
    65  	return ua.Name == Edge
    66  }
    67  
    68  // IsGooglebot shorthand function to check if Name == Googlebot
    69  func (ua UserAgent) IsGooglebot() bool {
    70  	return ua.Name == Googlebot
    71  }
    72  
    73  // IsTwitterbot shorthand function to check if Name == Twitterbot
    74  func (ua UserAgent) IsTwitterbot() bool {
    75  	return ua.Name == Twitterbot
    76  }
    77  
    78  // IsFacebookbot shorthand function to check if Name == FacebookExternalHit
    79  func (ua UserAgent) IsFacebookbot() bool {
    80  	return ua.Name == FacebookExternalHit
    81  }