Socket
Socket
Sign inDemoInstall

express-useragent

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-useragent - npm Package Compare versions

Comparing version 0.1.8 to 0.1.9

4

lib/express-useragent.js

@@ -511,3 +511,3 @@ /*!

var ua = this;
if (/googlebot|baiduspider|gurujibot|yandexbot|slurp|msnbot|bingbot|facebookexternalhit|linkedinbot|twitterbot|slackbot/i.test(ua.Agent.source)) {
if (/googlebot|baiduspider|gurujibot|yandexbot|slurp|msnbot|bingbot|facebookexternalhit|linkedinbot|twitterbot|slackbot|telegrambot|applebot/i.test(ua.Agent.source)) {
ua.Agent.isBot = true;

@@ -548,2 +548,2 @@ }

})(this);
})(this);

@@ -6,2 +6,2 @@ /*!

*/
!function(a){"use strict";var b=function(){return this.version="0.1.8",this._Versions={Firefox:/firefox\/([\d\w\.\-]+)/i,IE:/msie\s([\d\.]+[\d])|trident\/\d+\.\d+;.*[rv:]+(\d+\.\d)/i,Chrome:/chrome\/([\d\w\.\-]+)/i,Chromium:/(?:chromium|crios)\/([\d\w\.\-]+)/i,Safari:/version\/([\d\w\.\-]+)/i,Opera:/version\/([\d\w\.\-]+)/i,Ps3:/([\d\w\.\-]+)\)\s*$/i,Psp:/([\d\w\.\-]+)\)?\s*$/i,Amaya:/amaya\/([\d\w\.\-]+)/i,SeaMonkey:/seamonkey\/([\d\w\.\-]+)/i,OmniWeb:/omniweb\/v([\d\w\.\-]+)/i,Flock:/flock\/([\d\w\.\-]+)/i,Epiphany:/epiphany\/([\d\w\.\-]+)/i,WinJs:/msapphost\/([\d\w\.\-]+)/i},this._Browsers={Amaya:/amaya/i,Konqueror:/konqueror/i,Epiphany:/epiphany/i,SeaMonkey:/seamonkey/i,Flock:/flock/i,OmniWeb:/omniweb/i,Chromium:/chromium|crios/i,Chrome:/chrome/i,Safari:/safari/i,IE:/msie|trident/i,Opera:/opera/i,PS3:/playstation 3/i,PSP:/playstation portable/i,Firefox:/firefox/i,WinJs:/msapphost/i},this._OS={Windows10:/windows nt 10\.0/i,Windows81:/windows nt 6\.3/i,Windows8:/windows nt 6\.2/i,Windows7:/windows nt 6\.1/i,UnknownWindows:/windows nt 6\.\d+/i,WindowsVista:/windows nt 6\.0/i,Windows2003:/windows nt 5\.2/i,WindowsXP:/windows nt 5\.1/i,Windows2000:/windows nt 5\.0/i,WindowsPhone8:/windows phone 8\./,OSX:/os x (\d+)[._](\d+)/i,Mac:/os x/i,Linux:/linux/i,Linux64:/linux x86\_64/i,ChromeOS:/cros/i,Wii:/wii/i,PS3:/playstation 3/i,PSP:/playstation portable/i,iPad:/\(iPad.*os (\d+)[._](\d+)/i,iPhone:/\(iPhone.*os (\d+)[._](\d+)/i,Bada:/Bada\/(\d+)\.(\d+)/i,Curl:/curl\/(\d+)\.(\d+)\.(\d+)/i},this._Platform={Windows:/windows nt/i,WindowsPhone:/windows phone/i,Mac:/macintosh/i,Linux:/linux/i,Wii:/wii/i,Playstation:/playstation/i,iPad:/ipad/i,iPod:/ipod/i,iPhone:/iphone/i,Android:/android/i,Blackberry:/blackberry/i,Samsung:/samsung/i,Curl:/curl/i},this.DefaultAgent={isMobile:!1,isTablet:!1,isiPad:!1,isiPod:!1,isiPhone:!1,isAndroid:!1,isBlackberry:!1,isOpera:!1,isIE:!1,isIECompatibilityMode:!1,isSafari:!1,isFirefox:!1,isWebkit:!1,isChrome:!1,isKonqueror:!1,isOmniWeb:!1,isSeaMonkey:!1,isFlock:!1,isAmaya:!1,isEpiphany:!1,isDesktop:!1,isWindows:!1,isLinux:!1,isLinux64:!1,isMac:!1,isChromeOS:!1,isBada:!1,isSamsung:!1,isRaspberry:!1,isBot:!1,isCurl:!1,isAndroidTablet:!1,isWinJs:!1,isKindleFire:!1,isSilk:!1,silkAccelerated:!1,browser:"unknown",version:"unknown",os:"unknown",platform:"unknown",geoIp:{},source:""},this.Agent={},this.getBrowser=function(a){switch(!0){case this._Browsers.Konqueror.test(a):return this.Agent.isKonqueror=!0,"Konqueror";case this._Browsers.Amaya.test(a):return this.Agent.isAmaya=!0,"Amaya";case this._Browsers.Epiphany.test(a):return this.Agent.isEpiphany=!0,"Epiphany";case this._Browsers.SeaMonkey.test(a):return this.Agent.isSeaMonkey=!0,"SeaMonkey";case this._Browsers.Flock.test(a):return this.Agent.isFlock=!0,"Flock";case this._Browsers.OmniWeb.test(a):return this.Agent.isOmniWeb=!0,"OmniWeb";case this._Browsers.Chromium.test(a):return this.Agent.isChrome=!0,"Chromium";case this._Browsers.Chrome.test(a):return this.Agent.isChrome=!0,"Chrome";case this._Browsers.Safari.test(a):return this.Agent.isSafari=!0,"Safari";case this._Browsers.WinJs.test(a):return this.Agent.isWinJs=!0,"WinJs";case this._Browsers.IE.test(a):return this.Agent.isIE=!0,"IE";case this._Browsers.Opera.test(a):return this.Agent.isOpera=!0,"Opera";case this._Browsers.PS3.test(a):return"ps3";case this._Browsers.PSP.test(a):return"psp";case this._Browsers.Firefox.test(a):return this.Agent.isFirefox=!0,"Firefox";default:return"unknown"}},this.getBrowserVersion=function(a){var b;switch(this.Agent.browser){case"Chrome":if(this._Versions.Chrome.test(a))return RegExp.$1;break;case"Chromium":if(this._Versions.Chromium.test(a))return RegExp.$1;break;case"Safari":if(this._Versions.Safari.test(a))return RegExp.$1;break;case"Opera":if(this._Versions.Opera.test(a))return RegExp.$1;break;case"Firefox":if(this._Versions.Firefox.test(a))return RegExp.$1;break;case"WinJs":if(this._Versions.WinJs.test(a))return RegExp.$1;break;case"IE":if(this._Versions.IE.test(a))return RegExp.$2?RegExp.$2:RegExp.$1;break;case"ps3":if(this._Versions.Ps3.test(a))return RegExp.$1;break;case"psp":if(this._Versions.Psp.test(a))return RegExp.$1;break;case"Amaya":if(this._Versions.Amaya.test(a))return RegExp.$1;break;case"Epiphany":if(this._Versions.Epiphany.test(a))return RegExp.$1;break;case"SeaMonkey":if(this._Versions.SeaMonkey.test(a))return RegExp.$1;break;case"Flock":if(this._Versions.Flock.test(a))return RegExp.$1;break;case"OmniWeb":if(this._Versions.OmniWeb.test(a))return RegExp.$1;break;default:if(b=/#{name}[\/ ]([\d\w\.\-]+)/i,b.test(a))return RegExp.$1}},this.getOS=function(a){switch(!0){case this._OS.WindowsVista.test(a):return this.Agent.isWindows=!0,"Windows Vista";case this._OS.Windows7.test(a):return this.Agent.isWindows=!0,"Windows 7";case this._OS.Windows8.test(a):return this.Agent.isWindows=!0,"Windows 8";case this._OS.Windows81.test(a):return this.Agent.isWindows=!0,"Windows 8.1";case this._OS.Windows10.test(a):return this.Agent.isWindows=!0,"Windows 10.0";case this._OS.Windows2003.test(a):return this.Agent.isWindows=!0,"Windows 2003";case this._OS.WindowsXP.test(a):return this.Agent.isWindows=!0,"Windows XP";case this._OS.Windows2000.test(a):return this.Agent.isWindows=!0,"Windows 2000";case this._OS.WindowsPhone8.test(a):return"Windows Phone 8";case this._OS.Linux64.test(a):return this.Agent.isLinux=!0,this.Agent.isLinux64=!0,"Linux 64";case this._OS.Linux.test(a):return this.Agent.isLinux=!0,"Linux";case this._OS.ChromeOS.test(a):return this.Agent.isChromeOS=!0,"Chrome OS";case this._OS.Wii.test(a):return"Wii";case this._OS.PS3.test(a):return"Playstation";case this._OS.PSP.test(a):return"Playstation";case this._OS.Mac.test(a):return this.Agent.isMac=!0,"OS X";case this._OS.OSX.test(a):return this.Agent.isMac=!0,a.match(this._OS.OSX)[0].replace("_",".");case this._OS.iPad.test(a):return this.Agent.isiPad=!0,a.match(this._OS.iPad)[0].replace("_",".");case this._OS.iPhone.test(a):return this.Agent.isiPhone=!0,a.match(this._OS.iPhone)[0].replace("_",".");case this._OS.Bada.test(a):return this.Agent.isBada=!0,"Bada";case this._OS.Curl.test(a):return this.Agent.isCurl=!0,"Curl";default:return"unknown"}},this.getPlatform=function(a){switch(!0){case this._Platform.Windows.test(a):return"Microsoft Windows";case this._Platform.WindowsPhone.test(a):return this.Agent.isWindowsPhone=!0,"Microsoft Windows Phone";case this._Platform.Mac.test(a):return"Apple Mac";case this._Platform.Curl.test(a):return"Curl";case this._Platform.Android.test(a):return this.Agent.isAndroid=!0,"Android";case this._Platform.Blackberry.test(a):return this.Agent.isBlackberry=!0,"Blackberry";case this._Platform.Linux.test(a):return"Linux";case this._Platform.Wii.test(a):return"Wii";case this._Platform.Playstation.test(a):return"Playstation";case this._Platform.iPad.test(a):return this.Agent.isiPad=!0,"iPad";case this._Platform.iPod.test(a):return this.Agent.isiPod=!0,"iPod";case this._Platform.iPhone.test(a):return this.Agent.isiPhone=!0,"iPhone";case this._Platform.Samsung.test(a):return this.Agent.isiSamsung=!0,"Samsung";default:return"unknown"}},this.testCompatibilityMode=function(){var a=this;if(this.Agent.isIE&&/Trident\/(\d)\.0/i.test(a.Agent.source)){var b=parseInt(RegExp.$1,10),c=parseInt(a.Agent.version,10);7===c&&6===b&&(a.Agent.isIECompatibilityMode=!0,a.Agent.version=10),7===c&&5===b&&(a.Agent.isIECompatibilityMode=!0,a.Agent.version=9),7===c&&4===b&&(a.Agent.isIECompatibilityMode=!0,a.Agent.version=8)}},this.testSilk=function(){var a=this;switch(!0){case new RegExp("silk","gi").test(a.Agent.source):this.Agent.isSilk=!0}return/Silk-Accelerated=true/gi.test(a.Agent.source)&&(this.Agent.SilkAccelerated=!0),this.Agent.isSilk?"Silk":!1},this.testKindleFire=function(){var a=this;switch(!0){case/KFOT/gi.test(a.Agent.source):return this.Agent.isKindleFire=!0,"Kindle Fire";case/KFTT/gi.test(a.Agent.source):return this.Agent.isKindleFire=!0,"Kindle Fire HD";case/KFJWI/gi.test(a.Agent.source):return this.Agent.isKindleFire=!0,"Kindle Fire HD 8.9";case/KFJWA/gi.test(a.Agent.source):return this.Agent.isKindleFire=!0,"Kindle Fire HD 8.9 4G";case/KFSOWI/gi.test(a.Agent.source):return this.Agent.isKindleFire=!0,"Kindle Fire HD 7";case/KFTHWI/gi.test(a.Agent.source):return this.Agent.isKindleFire=!0,"Kindle Fire HDX 7";case/KFTHWA/gi.test(a.Agent.source):return this.Agent.isKindleFire=!0,"Kindle Fire HDX 7 4G";case/KFAPWI/gi.test(a.Agent.source):return this.Agent.isKindleFire=!0,"Kindle Fire HDX 8.9";case/KFAPWA/gi.test(a.Agent.source):return this.Agent.isKindleFire=!0,"Kindle Fire HDX 8.9 4G";default:return!1}},this.reset=function(){var a=this;for(var b in a.DefaultAgent)a.Agent[b]=a.DefaultAgent[b];return a},this.testMobile=function(){var a=this;switch(!0){case a.Agent.isWindows:case a.Agent.isLinux:case a.Agent.isMac:case a.Agent.isChromeOS:a.Agent.isDesktop=!0;break;case a.Agent.isAndroid:case a.Agent.isSamsung:a.Agent.isMobile=!0,a.Agent.isDesktop=!1}switch(!0){case a.Agent.isiPad:case a.Agent.isiPod:case a.Agent.isiPhone:case a.Agent.isBada:case a.Agent.isBlackberry:case a.Agent.isAndroid:case a.Agent.isWindowsPhone:a.Agent.isMobile=!0,a.Agent.isDesktop=!1}/mobile/i.test(a.Agent.source)&&(a.Agent.isMobile=!0,a.Agent.isDesktop=!1)},this.testTablet=function(){var a=this;switch(!0){case a.Agent.isiPad:case a.Agent.isAndroidTablet:case a.Agent.isKindleFire:a.Agent.isTablet=!0}/tablet/i.test(a.Agent.source)&&(a.Agent.isTablet=!0)},this.testNginxGeoIP=function(a){var b=this;Object.keys(a).forEach(function(c){/^GEOIP/i.test(c)&&(b.Agent.geoIp[c]=a[c])})},this.testBot=function(){var a=this;/googlebot|baiduspider|gurujibot|yandexbot|slurp|msnbot|bingbot|facebookexternalhit|linkedinbot|twitterbot|slackbot/i.test(a.Agent.source)&&(a.Agent.isBot=!0)},this.testAndroidTablet=function(){var a=this;a.Agent.isAndroid&&!/mobile/i.test(a.Agent.source)&&(a.Agent.isAndroidTablet=!0)},this.parse=function(a){var c=new b;return c.Agent.source=a.replace(/^\s*/,"").replace(/\s*$/,""),c.Agent.os=c.getOS(c.Agent.source),c.Agent.platform=c.getPlatform(c.Agent.source),c.Agent.browser=c.getBrowser(c.Agent.source),c.Agent.version=c.getBrowserVersion(c.Agent.source),c.testBot(),c.testMobile(),c.testAndroidTablet(),c.testTablet(),c.testCompatibilityMode(),c.testSilk(),c.testKindleFire(),c.Agent},this.Agent=this.DefaultAgent,this};return a.UserAgent=b,new b}(this);
!function(a){"use strict";var b=function(){return this.version="0.1.8",this._Versions={Firefox:/firefox\/([\d\w\.\-]+)/i,IE:/msie\s([\d\.]+[\d])|trident\/\d+\.\d+;.*[rv:]+(\d+\.\d)/i,Chrome:/chrome\/([\d\w\.\-]+)/i,Chromium:/(?:chromium|crios)\/([\d\w\.\-]+)/i,Safari:/version\/([\d\w\.\-]+)/i,Opera:/version\/([\d\w\.\-]+)/i,Ps3:/([\d\w\.\-]+)\)\s*$/i,Psp:/([\d\w\.\-]+)\)?\s*$/i,Amaya:/amaya\/([\d\w\.\-]+)/i,SeaMonkey:/seamonkey\/([\d\w\.\-]+)/i,OmniWeb:/omniweb\/v([\d\w\.\-]+)/i,Flock:/flock\/([\d\w\.\-]+)/i,Epiphany:/epiphany\/([\d\w\.\-]+)/i,WinJs:/msapphost\/([\d\w\.\-]+)/i},this._Browsers={Amaya:/amaya/i,Konqueror:/konqueror/i,Epiphany:/epiphany/i,SeaMonkey:/seamonkey/i,Flock:/flock/i,OmniWeb:/omniweb/i,Chromium:/chromium|crios/i,Chrome:/chrome/i,Safari:/safari/i,IE:/msie|trident/i,Opera:/opera/i,PS3:/playstation 3/i,PSP:/playstation portable/i,Firefox:/firefox/i,WinJs:/msapphost/i},this._OS={Windows10:/windows nt 10\.0/i,Windows81:/windows nt 6\.3/i,Windows8:/windows nt 6\.2/i,Windows7:/windows nt 6\.1/i,UnknownWindows:/windows nt 6\.\d+/i,WindowsVista:/windows nt 6\.0/i,Windows2003:/windows nt 5\.2/i,WindowsXP:/windows nt 5\.1/i,Windows2000:/windows nt 5\.0/i,WindowsPhone8:/windows phone 8\./,OSX:/os x (\d+)[._](\d+)/i,Mac:/os x/i,Linux:/linux/i,Linux64:/linux x86\_64/i,ChromeOS:/cros/i,Wii:/wii/i,PS3:/playstation 3/i,PSP:/playstation portable/i,iPad:/\(iPad.*os (\d+)[._](\d+)/i,iPhone:/\(iPhone.*os (\d+)[._](\d+)/i,Bada:/Bada\/(\d+)\.(\d+)/i,Curl:/curl\/(\d+)\.(\d+)\.(\d+)/i},this._Platform={Windows:/windows nt/i,WindowsPhone:/windows phone/i,Mac:/macintosh/i,Linux:/linux/i,Wii:/wii/i,Playstation:/playstation/i,iPad:/ipad/i,iPod:/ipod/i,iPhone:/iphone/i,Android:/android/i,Blackberry:/blackberry/i,Samsung:/samsung/i,Curl:/curl/i},this.DefaultAgent={isMobile:!1,isTablet:!1,isiPad:!1,isiPod:!1,isiPhone:!1,isAndroid:!1,isBlackberry:!1,isOpera:!1,isIE:!1,isIECompatibilityMode:!1,isSafari:!1,isFirefox:!1,isWebkit:!1,isChrome:!1,isKonqueror:!1,isOmniWeb:!1,isSeaMonkey:!1,isFlock:!1,isAmaya:!1,isEpiphany:!1,isDesktop:!1,isWindows:!1,isLinux:!1,isLinux64:!1,isMac:!1,isChromeOS:!1,isBada:!1,isSamsung:!1,isRaspberry:!1,isBot:!1,isCurl:!1,isAndroidTablet:!1,isWinJs:!1,isKindleFire:!1,isSilk:!1,silkAccelerated:!1,browser:"unknown",version:"unknown",os:"unknown",platform:"unknown",geoIp:{},source:""},this.Agent={},this.getBrowser=function(a){switch(!0){case this._Browsers.Konqueror.test(a):return this.Agent.isKonqueror=!0,"Konqueror";case this._Browsers.Amaya.test(a):return this.Agent.isAmaya=!0,"Amaya";case this._Browsers.Epiphany.test(a):return this.Agent.isEpiphany=!0,"Epiphany";case this._Browsers.SeaMonkey.test(a):return this.Agent.isSeaMonkey=!0,"SeaMonkey";case this._Browsers.Flock.test(a):return this.Agent.isFlock=!0,"Flock";case this._Browsers.OmniWeb.test(a):return this.Agent.isOmniWeb=!0,"OmniWeb";case this._Browsers.Chromium.test(a):return this.Agent.isChrome=!0,"Chromium";case this._Browsers.Chrome.test(a):return this.Agent.isChrome=!0,"Chrome";case this._Browsers.Safari.test(a):return this.Agent.isSafari=!0,"Safari";case this._Browsers.WinJs.test(a):return this.Agent.isWinJs=!0,"WinJs";case this._Browsers.IE.test(a):return this.Agent.isIE=!0,"IE";case this._Browsers.Opera.test(a):return this.Agent.isOpera=!0,"Opera";case this._Browsers.PS3.test(a):return"ps3";case this._Browsers.PSP.test(a):return"psp";case this._Browsers.Firefox.test(a):return this.Agent.isFirefox=!0,"Firefox";default:return"unknown"}},this.getBrowserVersion=function(a){var b;switch(this.Agent.browser){case"Chrome":if(this._Versions.Chrome.test(a))return RegExp.$1;break;case"Chromium":if(this._Versions.Chromium.test(a))return RegExp.$1;break;case"Safari":if(this._Versions.Safari.test(a))return RegExp.$1;break;case"Opera":if(this._Versions.Opera.test(a))return RegExp.$1;break;case"Firefox":if(this._Versions.Firefox.test(a))return RegExp.$1;break;case"WinJs":if(this._Versions.WinJs.test(a))return RegExp.$1;break;case"IE":if(this._Versions.IE.test(a))return RegExp.$2?RegExp.$2:RegExp.$1;break;case"ps3":if(this._Versions.Ps3.test(a))return RegExp.$1;break;case"psp":if(this._Versions.Psp.test(a))return RegExp.$1;break;case"Amaya":if(this._Versions.Amaya.test(a))return RegExp.$1;break;case"Epiphany":if(this._Versions.Epiphany.test(a))return RegExp.$1;break;case"SeaMonkey":if(this._Versions.SeaMonkey.test(a))return RegExp.$1;break;case"Flock":if(this._Versions.Flock.test(a))return RegExp.$1;break;case"OmniWeb":if(this._Versions.OmniWeb.test(a))return RegExp.$1;break;default:if(b=/#{name}[\/ ]([\d\w\.\-]+)/i,b.test(a))return RegExp.$1}},this.getOS=function(a){switch(!0){case this._OS.WindowsVista.test(a):return this.Agent.isWindows=!0,"Windows Vista";case this._OS.Windows7.test(a):return this.Agent.isWindows=!0,"Windows 7";case this._OS.Windows8.test(a):return this.Agent.isWindows=!0,"Windows 8";case this._OS.Windows81.test(a):return this.Agent.isWindows=!0,"Windows 8.1";case this._OS.Windows10.test(a):return this.Agent.isWindows=!0,"Windows 10.0";case this._OS.Windows2003.test(a):return this.Agent.isWindows=!0,"Windows 2003";case this._OS.WindowsXP.test(a):return this.Agent.isWindows=!0,"Windows XP";case this._OS.Windows2000.test(a):return this.Agent.isWindows=!0,"Windows 2000";case this._OS.WindowsPhone8.test(a):return"Windows Phone 8";case this._OS.Linux64.test(a):return this.Agent.isLinux=!0,this.Agent.isLinux64=!0,"Linux 64";case this._OS.Linux.test(a):return this.Agent.isLinux=!0,"Linux";case this._OS.ChromeOS.test(a):return this.Agent.isChromeOS=!0,"Chrome OS";case this._OS.Wii.test(a):return"Wii";case this._OS.PS3.test(a):return"Playstation";case this._OS.PSP.test(a):return"Playstation";case this._OS.Mac.test(a):return this.Agent.isMac=!0,"OS X";case this._OS.OSX.test(a):return this.Agent.isMac=!0,a.match(this._OS.OSX)[0].replace("_",".");case this._OS.iPad.test(a):return this.Agent.isiPad=!0,a.match(this._OS.iPad)[0].replace("_",".");case this._OS.iPhone.test(a):return this.Agent.isiPhone=!0,a.match(this._OS.iPhone)[0].replace("_",".");case this._OS.Bada.test(a):return this.Agent.isBada=!0,"Bada";case this._OS.Curl.test(a):return this.Agent.isCurl=!0,"Curl";default:return"unknown"}},this.getPlatform=function(a){switch(!0){case this._Platform.Windows.test(a):return"Microsoft Windows";case this._Platform.WindowsPhone.test(a):return this.Agent.isWindowsPhone=!0,"Microsoft Windows Phone";case this._Platform.Mac.test(a):return"Apple Mac";case this._Platform.Curl.test(a):return"Curl";case this._Platform.Android.test(a):return this.Agent.isAndroid=!0,"Android";case this._Platform.Blackberry.test(a):return this.Agent.isBlackberry=!0,"Blackberry";case this._Platform.Linux.test(a):return"Linux";case this._Platform.Wii.test(a):return"Wii";case this._Platform.Playstation.test(a):return"Playstation";case this._Platform.iPad.test(a):return this.Agent.isiPad=!0,"iPad";case this._Platform.iPod.test(a):return this.Agent.isiPod=!0,"iPod";case this._Platform.iPhone.test(a):return this.Agent.isiPhone=!0,"iPhone";case this._Platform.Samsung.test(a):return this.Agent.isiSamsung=!0,"Samsung";default:return"unknown"}},this.testCompatibilityMode=function(){var a=this;if(this.Agent.isIE&&/Trident\/(\d)\.0/i.test(a.Agent.source)){var b=parseInt(RegExp.$1,10),c=parseInt(a.Agent.version,10);7===c&&6===b&&(a.Agent.isIECompatibilityMode=!0,a.Agent.version=10),7===c&&5===b&&(a.Agent.isIECompatibilityMode=!0,a.Agent.version=9),7===c&&4===b&&(a.Agent.isIECompatibilityMode=!0,a.Agent.version=8)}},this.testSilk=function(){var a=this;switch(!0){case new RegExp("silk","gi").test(a.Agent.source):this.Agent.isSilk=!0}return/Silk-Accelerated=true/gi.test(a.Agent.source)&&(this.Agent.SilkAccelerated=!0),this.Agent.isSilk?"Silk":!1},this.testKindleFire=function(){var a=this;switch(!0){case/KFOT/gi.test(a.Agent.source):return this.Agent.isKindleFire=!0,"Kindle Fire";case/KFTT/gi.test(a.Agent.source):return this.Agent.isKindleFire=!0,"Kindle Fire HD";case/KFJWI/gi.test(a.Agent.source):return this.Agent.isKindleFire=!0,"Kindle Fire HD 8.9";case/KFJWA/gi.test(a.Agent.source):return this.Agent.isKindleFire=!0,"Kindle Fire HD 8.9 4G";case/KFSOWI/gi.test(a.Agent.source):return this.Agent.isKindleFire=!0,"Kindle Fire HD 7";case/KFTHWI/gi.test(a.Agent.source):return this.Agent.isKindleFire=!0,"Kindle Fire HDX 7";case/KFTHWA/gi.test(a.Agent.source):return this.Agent.isKindleFire=!0,"Kindle Fire HDX 7 4G";case/KFAPWI/gi.test(a.Agent.source):return this.Agent.isKindleFire=!0,"Kindle Fire HDX 8.9";case/KFAPWA/gi.test(a.Agent.source):return this.Agent.isKindleFire=!0,"Kindle Fire HDX 8.9 4G";default:return!1}},this.reset=function(){var a=this;for(var b in a.DefaultAgent)a.Agent[b]=a.DefaultAgent[b];return a},this.testMobile=function(){var a=this;switch(!0){case a.Agent.isWindows:case a.Agent.isLinux:case a.Agent.isMac:case a.Agent.isChromeOS:a.Agent.isDesktop=!0;break;case a.Agent.isAndroid:case a.Agent.isSamsung:a.Agent.isMobile=!0,a.Agent.isDesktop=!1}switch(!0){case a.Agent.isiPad:case a.Agent.isiPod:case a.Agent.isiPhone:case a.Agent.isBada:case a.Agent.isBlackberry:case a.Agent.isAndroid:case a.Agent.isWindowsPhone:a.Agent.isMobile=!0,a.Agent.isDesktop=!1}/mobile/i.test(a.Agent.source)&&(a.Agent.isMobile=!0,a.Agent.isDesktop=!1)},this.testTablet=function(){var a=this;switch(!0){case a.Agent.isiPad:case a.Agent.isAndroidTablet:case a.Agent.isKindleFire:a.Agent.isTablet=!0}/tablet/i.test(a.Agent.source)&&(a.Agent.isTablet=!0)},this.testNginxGeoIP=function(a){var b=this;Object.keys(a).forEach(function(c){/^GEOIP/i.test(c)&&(b.Agent.geoIp[c]=a[c])})},this.testBot=function(){var a=this;/googlebot|baiduspider|gurujibot|yandexbot|slurp|msnbot|bingbot|facebookexternalhit|linkedinbot|twitterbot|slackbot|telegrambot|applebot/i.test(a.Agent.source)&&(a.Agent.isBot=!0)},this.testAndroidTablet=function(){var a=this;a.Agent.isAndroid&&!/mobile/i.test(a.Agent.source)&&(a.Agent.isAndroidTablet=!0)},this.parse=function(a){var c=new b;return c.Agent.source=a.replace(/^\s*/,"").replace(/\s*$/,""),c.Agent.os=c.getOS(c.Agent.source),c.Agent.platform=c.getPlatform(c.Agent.source),c.Agent.browser=c.getBrowser(c.Agent.source),c.Agent.version=c.getBrowserVersion(c.Agent.source),c.testBot(),c.testMobile(),c.testAndroidTablet(),c.testTablet(),c.testCompatibilityMode(),c.testSilk(),c.testKindleFire(),c.Agent},this.Agent=this.DefaultAgent,this};return a.UserAgent=b,new b}(this);
{
"name": "express-useragent",
"description": "ExpressJS/Connect/TrinteJS user-agent middleware exposing",
"version": "0.1.8",
"version": "0.1.9",
"homepage": "https://github.com/biggora/express-useragent/",

@@ -6,0 +6,0 @@ "repository": {

@@ -5,3 +5,3 @@ [![build status](https://secure.travis-ci.org/biggora/express-useragent.png)](http://travis-ci.org/biggora/express-useragent)

express-useragent is a simple ExpressJS user-agent middleware exposing user-agent details to your application and views.
express-useragent is a simple NodeJS/ExpressJS user-agent middleware exposing user-agent details to your application and views.

@@ -12,4 +12,5 @@ ## Installation

To install express-useragent:
```bash
$ npm install express-useragent --save
```

@@ -72,6 +73,6 @@ ## Usage overview

.....
"Browser":"Chrome",
"Version":"17.0.963.79",
"OS":"Windows 7",
"Platform":"Microsoft Windows",
"browser":"Chrome",
"version":"17.0.963.79",
"os":"Windows 7",
"platform":"Microsoft Windows",
"source":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.79..."

@@ -108,3 +109,4 @@ }

To run the test suite, first install the dependencies, then run `npm test`:
Ensure you have [nodeunit](https://github.com/caolan/nodeunit) by running ```npm install -g nodeunit```.
Then, run ```npm test```.

@@ -151,9 +153,5 @@ ```bash

## Running Tests
Ensure you have [nodeunit](https://github.com/caolan/nodeunit) by running ```npm install -g nodeunit```.
Then, run ```npm test```.
## Author
Aleksej Gordejev (aleksej@gordejev.lv).
Alexey Gordeyev (aleksej@gordejev.lv).

@@ -164,3 +162,3 @@ ## License

Copyright (c) 2012 Aleksej Gordejev <aleksej@gordejev.lv>
Copyright (c) 2012 Alexey Gordeyev <aleksej@gordejev.lv>

@@ -167,0 +165,0 @@ Permission is hereby granted, free of charge, to any person obtaining

@@ -15,15 +15,18 @@ /**

var Express = require('express')
, App = Express()
, Useragent = require('./../');
var express = require('express')
, app = express()
, useragent = require('./../');
App.use(Useragent.express());
app.use(useragent.express());
app.use(express.static(__dirname +''));
App.get('/', function (req, res) {
app.get('/', function (req, res) {
res.send(req.useragent);
});
app.get('/demo', function (req, res) {
res.sendfile('./test/client_test.html');
});
// To test it try http://localhost:3000/
App.listen(3000);
app.listen(3000);
console.log('App started on port 3000');

@@ -15,8 +15,8 @@ /**

var Http = require('http')
, Useragent = require('./../');
var http = require('http')
, useragent = require('./../');
var App = Http.createServer(function (req, res) {
var app = http.createServer(function (req, res) {
var source = req.headers['user-agent'],
ua = Useragent.parse(source);
ua = useragent.parse(source);
res.writeHead(200, {'Content-Type': 'text/plain'});

@@ -28,5 +28,5 @@ res.end(JSON.stringify(ua));

App.listen(3000);
app.listen(3000);
console.log('App started on port 3000');

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc