Comparing version 1.1.4 to 1.2.0
{ | ||
"name": "sniffr", | ||
"version": "1.1.4", | ||
"version": "1.2.0", | ||
"description": "Browser, os and device detection", | ||
@@ -11,2 +11,10 @@ "main": "src/sniffr.js", | ||
], | ||
"scripts": { | ||
"lint": "./node_modules/.bin/eslint src/* spec/*", | ||
"test": "./node_modules/.bin/karma start karma.conf.js", | ||
"test:tdd": "./node_modules/.bin/karma start karma.conf.js --tdd", | ||
"concat": "./node_modules/.bin/concat -o dist/sniffr.js src/modern.js.polyfill.js src/sniffr.js", | ||
"uglify": "./node_modules/.bin/uglifyjs --compress --mangle --output dist/sniffr.min.js -- dist/sniffr.js", | ||
"dist": "npm run concat && npm run uglify" | ||
}, | ||
"repository": { | ||
@@ -33,15 +41,14 @@ "type": "git", | ||
"devDependencies": { | ||
"bower": "~1.3.2", | ||
"express": "^4.13.4", | ||
"grunt": "~0.4.4", | ||
"grunt-cli": "~0.1.13", | ||
"grunt-contrib-concat": "~0.5.0", | ||
"grunt-contrib-jasmine": "~0.9.2", | ||
"grunt-contrib-jshint": "~0.10.0", | ||
"grunt-contrib-uglify": "~0.5.1" | ||
"chai": "^4.2.0", | ||
"concat": "^1.0.3", | ||
"eslint": "^5.10.0", | ||
"karma": "^3.1.3", | ||
"karma-chrome-launcher": "^2.2.0", | ||
"karma-mocha": "^1.3.0", | ||
"karma-spec-reporter": "0.0.32", | ||
"mocha": "^5.2.0", | ||
"mocha-html-reporter": "0.0.1", | ||
"uglify-js": "^3.4.9" | ||
}, | ||
"homepage": "https://github.com/antivanov/sniffr", | ||
"scripts": { | ||
"test": "grunt lint test" | ||
} | ||
"homepage": "https://github.com/antivanov/sniffr" | ||
} |
@@ -5,54 +5,54 @@ (function(host) { | ||
browser: [ | ||
[/msie ([\.\_\d]+)/, "ie"], | ||
[/trident\/.*?rv:([\.\_\d]+)/, "ie"], | ||
[/firefox\/([\.\_\d]+)/, "firefox"], | ||
[/chrome\/([\.\_\d]+)/, "chrome"], | ||
[/version\/([\.\_\d]+).*?safari/, "safari"], | ||
[/mobile safari ([\.\_\d]+)/, "safari"], | ||
[/android.*?version\/([\.\_\d]+).*?safari/, "com.android.browser"], | ||
[/crios\/([\.\_\d]+).*?safari/, "chrome"], | ||
[/opera/, "opera"], | ||
[/opera\/([\.\_\d]+)/, "opera"], | ||
[/opera ([\.\_\d]+)/, "opera"], | ||
[/opera mini.*?version\/([\.\_\d]+)/, "opera.mini"], | ||
[/opios\/([a-z\.\_\d]+)/, "opera"], | ||
[/blackberry/, "blackberry"], | ||
[/blackberry.*?version\/([\.\_\d]+)/, "blackberry"], | ||
[/bb\d+.*?version\/([\.\_\d]+)/, "blackberry"], | ||
[/rim.*?version\/([\.\_\d]+)/, "blackberry"], | ||
[/iceweasel\/([\.\_\d]+)/, "iceweasel"], | ||
[/edge\/([\.\d]+)/, "edge"] | ||
[/msie ([\.\_\d]+)/, 'ie'], | ||
[/trident\/.*?rv:([\.\_\d]+)/, 'ie'], | ||
[/firefox\/([\.\_\d]+)/, 'firefox'], | ||
[/chrome\/([\.\_\d]+)/, 'chrome'], | ||
[/version\/([\.\_\d]+).*?safari/, 'safari'], | ||
[/mobile safari ([\.\_\d]+)/, 'safari'], | ||
[/android.*?version\/([\.\_\d]+).*?safari/, 'com.android.browser'], | ||
[/crios\/([\.\_\d]+).*?safari/, 'chrome'], | ||
[/opera/, 'opera'], | ||
[/opera\/([\.\_\d]+)/, 'opera'], | ||
[/opera ([\.\_\d]+)/, 'opera'], | ||
[/opera mini.*?version\/([\.\_\d]+)/, 'opera.mini'], | ||
[/opios\/([a-z\.\_\d]+)/, 'opera'], | ||
[/blackberry/, 'blackberry'], | ||
[/blackberry.*?version\/([\.\_\d]+)/, 'blackberry'], | ||
[/bb\d+.*?version\/([\.\_\d]+)/, 'blackberry'], | ||
[/rim.*?version\/([\.\_\d]+)/, 'blackberry'], | ||
[/iceweasel\/([\.\_\d]+)/, 'iceweasel'], | ||
[/edge\/([\.\d]+)/, 'edge'] | ||
], | ||
os: [ | ||
[/linux ()([a-z\.\_\d]+)/, "linux"], | ||
[/mac os x/, "macos"], | ||
[/mac os x.*?([\.\_\d]+)/, "macos"], | ||
[/os ([\.\_\d]+) like mac os/, "ios"], | ||
[/openbsd ()([a-z\.\_\d]+)/, "openbsd"], | ||
[/android/, "android"], | ||
[/android ([a-z\.\_\d]+);/, "android"], | ||
[/mozilla\/[a-z\.\_\d]+ \((?:mobile)|(?:tablet)/, "firefoxos"], | ||
[/windows\s*(?:nt)?\s*([\.\_\d]+)/, "windows"], | ||
[/windows phone.*?([\.\_\d]+)/, "windows.phone"], | ||
[/windows mobile/, "windows.mobile"], | ||
[/blackberry/, "blackberryos"], | ||
[/bb\d+/, "blackberryos"], | ||
[/rim.*?os\s*([\.\_\d]+)/, "blackberryos"] | ||
[/linux ()([a-z\.\_\d]+)/, 'linux'], | ||
[/mac os x/, 'macos'], | ||
[/mac os x.*?([\.\_\d]+)/, 'macos'], | ||
[/os ([\.\_\d]+) like mac os/, 'ios'], | ||
[/openbsd ()([a-z\.\_\d]+)/, 'openbsd'], | ||
[/android/, 'android'], | ||
[/android ([a-z\.\_\d]+);/, 'android'], | ||
[/mozilla\/[a-z\.\_\d]+ \((?:mobile)|(?:tablet)/, 'firefoxos'], | ||
[/windows\s*(?:nt)?\s*([\.\_\d]+)/, 'windows'], | ||
[/windows phone.*?([\.\_\d]+)/, 'windows.phone'], | ||
[/windows mobile/, 'windows.mobile'], | ||
[/blackberry/, 'blackberryos'], | ||
[/bb\d+/, 'blackberryos'], | ||
[/rim.*?os\s*([\.\_\d]+)/, 'blackberryos'] | ||
], | ||
device: [ | ||
[/ipad/, "ipad"], | ||
[/iphone/, "iphone"], | ||
[/lumia/, "lumia"], | ||
[/htc/, "htc"], | ||
[/nexus/, "nexus"], | ||
[/galaxy nexus/, "galaxy.nexus"], | ||
[/nokia/, "nokia"], | ||
[/ gt\-/, "galaxy"], | ||
[/ sm\-/, "galaxy"], | ||
[/xbox/, "xbox"], | ||
[/(?:bb\d+)|(?:blackberry)|(?: rim )/, "blackberry"] | ||
[/ipad/, 'ipad'], | ||
[/iphone/, 'iphone'], | ||
[/lumia/, 'lumia'], | ||
[/htc/, 'htc'], | ||
[/nexus/, 'nexus'], | ||
[/galaxy nexus/, 'galaxy.nexus'], | ||
[/nokia/, 'nokia'], | ||
[/ gt\-/, 'galaxy'], | ||
[/ sm\-/, 'galaxy'], | ||
[/xbox/, 'xbox'], | ||
[/(?:bb\d+)|(?:blackberry)|(?: rim )/, 'blackberry'] | ||
] | ||
}; | ||
var UNKNOWN = "Unknown"; | ||
var UNKNOWN = 'Unknown'; | ||
@@ -87,3 +87,3 @@ var propertyNames = Object.keys(properties); | ||
} else if (match[1]) { | ||
self[propertyName].versionString = match[1].replace(/_/g, "."); | ||
self[propertyName].versionString = match[1].replace(/_/g, '.'); | ||
self[propertyName].version = parseVersion(match[1]); | ||
@@ -106,3 +106,5 @@ } else { | ||
var self = this; | ||
var userAgent = (userAgentString || navigator.userAgent || "").toLowerCase(); | ||
var isBrowser = typeof window !== 'undefined'; | ||
var fallbackUserAgent = isBrowser ? navigator.userAgent : ''; | ||
var userAgent = (userAgentString || fallbackUserAgent).toLowerCase(); | ||
@@ -112,2 +114,3 @@ propertyNames.forEach(function(propertyName) { | ||
}); | ||
return this; | ||
}; | ||
@@ -114,0 +117,0 @@ |
Sorry, the diff of this file is not supported yet
10304
107
10