Socket
Socket
Sign inDemoInstall

ua-parser-js

Package Overview
Dependencies
0
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.4.0 to 0.4.1

2

package.json
{
"title": "UA-Parser.JS",
"name": "ua-parser-js",
"version": "0.4.0",
"version": "0.4.1",
"author": "Faisal Salman <fyzlman@gmail.com> (http://faisalman.com)",

@@ -6,0 +6,0 @@ "description": "Lightweight JavaScript-based user-agent string parser",

@@ -66,3 +66,4 @@ # UA-Parser.JS

// let's take another test please
console.log(parser.setUA("Mozilla/5.0 (compatible; Konqueror/4.1; OpenBSD) KHTML/4.1.4 (like Gecko)").getOS().name); // "OpenBSD"
console.log(parser.setUA("Mozilla/5.0 (compatible; Konqueror/4.1; OpenBSD) KHTML/4.1.4 (like Gecko)").getBrowser().name); // "Konqueror"
console.log(parser.getOS()); // {name: "OpenBSD", version: undefined}
</script>

@@ -69,0 +70,0 @@ ```

@@ -1,2 +0,2 @@

// UA-Parser.JS v0.4.0
// UA-Parser.JS v0.4.1
// Lightweight JavaScript-based User-Agent string parser

@@ -10,2 +10,4 @@ // https://github.com/faisalman/ua-parser-js

'use strict';
var mapper = {

@@ -47,3 +49,7 @@

} else if (typeof props[k] === 'object' && props[k].length === 3) {
result[props[k][0]] = m ? m.replace(props[k][1], props[k][2]) : undefined;
if (typeof props[k][1] === 'function') {
result[props[k][0]] = m ? props[k][1].call(this, m, props[k][2]) : undefined;
} else {
result[props[k][0]] = m ? m.replace(props[k][1], props[k][2]) : undefined;
}
} else {

@@ -68,7 +74,7 @@ result[props[k]] = m ? m : undefined;

for (var j = 0; j < map[i].length; j++) {
if (str.toLowerCase().indexOf(map[i][j]) !== -1) {
if (str.toLowerCase().indexOf(map[i][j].toLowerCase()) !== -1) {
return i;
}
}
} else if (str.toLowerCase().indexOf(map[i]) !== -1) {
} else if (str.toLowerCase().indexOf(map[i].toLowerCase()) !== -1) {
return i;

@@ -85,13 +91,11 @@ }

windows : {
version : function (match, str1) {
return mapper.string(str1, {
'ME' : '4.90',
'NT 3.11' : 'nt3.51',
'NT 4.0' : 'nt4.0',
'2000' : 'nt 5.0',
'XP' : ['nt 5.1', 'nt 5.2'],
'Vista' : 'nt 6.0',
'7' : 'nt 6.1',
'8' : 'nt 6.2'
});
version : {
'ME' : '4.90',
'NT 3.11' : 'NT3.51',
'NT 4.0' : 'NT4.0',
'2000' : 'NT 5.0',
'XP' : ['NT 5.1', 'NT 5.2'],
'Vista' : 'NT 6.0',
'7' : 'NT 6.1',
'8' : 'NT 6.2'
}

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

/(kindle)\/((\d+)?[\w\.]+)/i, // Kindle
/(lunascape|maxthon|netfront|jasmine)[\/\s]?((\d+)?[\w\.]+)/i, // Lunascape/Maxthon/Netfront/Jasmine
/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?((\d+)?[\w\.]+)/i,
// Lunascape/Maxthon/Netfront/Jasmine/Blazer

@@ -122,4 +127,5 @@ // Presto based

// Webkit/KHTML based
/(chromium|flock|rockmelt|midori|epiphany|silk)\/((\d+)?[\w\.]+)/i, // Chromium/Flock/RockMelt/Midori/Epiphany
/(chrome|omniweb|arora|dolfin|[tizenaok]{5}\s?browser)\/((\d+)?[\w\.]+)/i,
/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|series60|bolt)\/((\d+)?[\w\.]+)/i,
// Chromium/Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/S60/Bolt
/(chrome|omniweb|arora|dolfin|[tizenoka]{5}\s?browser)\/((\d+)?[\w\.]+)/i,
// Chrome/OmniWeb/Arora/Dolphin/Tizen/Nokia

@@ -140,3 +146,4 @@ ], ['name', 'version', 'major'], [

// Other
/(lynx|dillo|icab)[\/\s]?((\d+)?[\w\.]+)/i, // Lynx/Dillo/iCab
/(lynx|dillo|icab|doris)[\/\s]?((\d+)?[\w\.]+)/i, // Lynx/Dillo/iCab/Doris
/(gobrowser)\/?[\d\.]*/i // GoBrowser
], ['name', 'version', 'major']

@@ -149,4 +156,4 @@ ],

/(blackberry)[\s-]?(\w+)/i, // BlackBerry
/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|nexus|zte)[\s_-]?([\w-]+)*/i,
// BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Nexus/ZTE
/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|nexus|zte|huawei)[\s_-]?([\w-]+)*/i,
// BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Nexus/ZTE/Huawei
/(hp)\s([\w\s]+\w)/i, // HP iPAQ

@@ -197,6 +204,6 @@ /(hp).+(touchpad)/i, // HP TouchPad

// Windows based
/(windows\sphone\sos|windows)\s?([nt\d\.\s]+\d)/i // Windows
], ['name', ['version', /(.+)/gi, maps.os.windows.version]], [
/(windows\sphone\sos|windows)\s?([ntce\d\.\s]+\d)/i // Windows
], ['name', ['version', mapper.string, maps.os.windows.version]], [
/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i
], [['name', 'Windows'], ['version', /(.+)/gi, maps.os.windows.version]], [
], [['name', 'Windows'], ['version', mapper.string, maps.os.windows.version]], [

@@ -230,3 +237,3 @@ // Mobile/Embedded OS

/(ip[honead]+).*os\s*([\w]+)*\slike\smac/i // iOS
], [['name', /.+/g, 'iOS'], ['version', /_/g, '.']], [
], [['name', 'iOS'], ['version', /_/g, '.']], [

@@ -291,4 +298,4 @@ /(mac\sos\sx)\s([\w\s\.]+\w)/i, // Mac OS

} else {
this['UAParser'] = UAParser;
window['UAParser'] = UAParser;
}
})();
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc