Comparing version 1.3.5 to 1.3.6
{ | ||
"name": "platform", | ||
"version": "1.3.5", | ||
"version": "1.3.6", | ||
"description": "A platform detection library that works on nearly all JavaScript platforms.", | ||
@@ -8,18 +8,20 @@ "license": "MIT", | ||
"keywords": "environment, platform, ua, useragent", | ||
"author": "Benjamin Tan <demoneaux@gmail.com> (https://demoneaux.github.io/)", | ||
"author": "Benjamin Tan <demoneaux@gmail.com>", | ||
"contributors": [ | ||
"Benjamin Tan <demoneaux@gmail.com> (https://demoneaux.github.io/)", | ||
"John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)", | ||
"Mathias Bynens <mathias@qiwi.be> (https://mathiasbynens.be/)" | ||
"Benjamin Tan <demoneaux@gmail.com>", | ||
"John-David Dalton <john.david.dalton@gmail.com>", | ||
"Mathias Bynens <mathias@qiwi.be>" | ||
], | ||
"repository": "bestiejs/platform.js", | ||
"scripts": { | ||
"doc": "docdown platform.js doc/README.md style=github title=\"Platform.js <sup>v${npm_package_version}</sup>\" toc=properties url=https://github.com/bestiejs/platform.js/blob/${npm_package_version}/platform.js", | ||
"test": "node test/test" | ||
"doc": "docdown platform.js doc/README.md style=github title=\"Platform.js v${npm_package_version}\" toc=properties url=https://github.com/bestiejs/platform.js/blob/${npm_package_version}/platform.js", | ||
"prepublishOnly": "node bump/bump.js ${npm_package_version}", | ||
"test": "node test/test.js" | ||
}, | ||
"devDependencies": { | ||
"docdown": "~0.7.2", | ||
"docdown": "^0.7.3", | ||
"qunit-extras": "^1.5.0", | ||
"qunitjs": "^1.23.1", | ||
"requirejs": "^2.3.3" | ||
"replace": "^1.1.0", | ||
"requirejs": "^2.3.6" | ||
}, | ||
@@ -26,0 +28,0 @@ "files": [ |
/*! | ||
* Platform.js <https://mths.be/platform> | ||
* Copyright 2014-2018 Benjamin Tan <https://bnjmnt4n.now.sh/> | ||
* Copyright 2011-2013 John-David Dalton <http://allyoucanleet.com/> | ||
* Available under MIT license <https://mths.be/mit> | ||
* Platform.js v1.3.6 | ||
* Copyright 2014-2020 Benjamin Tan | ||
* Copyright 2011-2013 John-David Dalton | ||
* Available under MIT license | ||
*/ | ||
@@ -372,3 +372,3 @@ ;(function() { | ||
'Maxthon', | ||
{ 'label': 'Microsoft Edge', 'pattern': 'Edge' }, | ||
{ 'label': 'Microsoft Edge', 'pattern': '(?:Edge|Edg|EdgA|EdgiOS)' }, | ||
'Midori', | ||
@@ -389,4 +389,7 @@ 'Nook Browser', | ||
'Swiftfox', | ||
'Vivaldi', | ||
'Waterfox', | ||
'WebPositive', | ||
{ 'label': 'Yandex Browser', 'pattern': 'YaBrowser' }, | ||
{ 'label': 'UC Browser', 'pattern': 'UCBrowser' }, | ||
'Opera Mini', | ||
@@ -396,3 +399,5 @@ { 'label': 'Opera Mini', 'pattern': 'OPiOS' }, | ||
{ 'label': 'Opera', 'pattern': 'OPR' }, | ||
'Chromium', | ||
'Chrome', | ||
{ 'label': 'Chrome', 'pattern': '(?:HeadlessChrome)' }, | ||
{ 'label': 'Chrome Mobile', 'pattern': '(?:CriOS|CrMo)' }, | ||
@@ -443,2 +448,3 @@ { 'label': 'Firefox', 'pattern': '(?:Firefox|Minefield)' }, | ||
'Apple': { 'iPad': 1, 'iPhone': 1, 'iPod': 1 }, | ||
'Alcatel': {}, | ||
'Archos': {}, | ||
@@ -452,2 +458,4 @@ 'Amazon': { 'Kindle': 1, 'Kindle Fire': 1 }, | ||
'HTC': {}, | ||
'Huawei': {}, | ||
'Lenovo': {}, | ||
'LG': {}, | ||
@@ -458,4 +466,6 @@ 'Microsoft': { 'Xbox': 1, 'Xbox One': 1 }, | ||
'Nokia': { 'Lumia': 1 }, | ||
'Oppo': {}, | ||
'Samsung': { 'Galaxy S': 1, 'Galaxy S2': 1, 'Galaxy S3': 1, 'Galaxy S4': 1 }, | ||
'Sony': { 'PlayStation': 1, 'PlayStation Vita': 1 } | ||
'Sony': { 'PlayStation': 1, 'PlayStation Vita': 1 }, | ||
'Xiaomi': { 'Mi': 1, 'Redmi': 1 } | ||
}); | ||
@@ -466,2 +476,3 @@ | ||
'Windows Phone', | ||
'KaiOS', | ||
'Android', | ||
@@ -471,2 +482,3 @@ 'CentOS', | ||
'Debian', | ||
{ 'label': 'DragonFly BSD', 'pattern': 'DragonFly' }, | ||
'Fedora', | ||
@@ -627,5 +639,22 @@ 'FreeBSD', | ||
// Detect Android products. | ||
// Browsers on Android devices typically provide their product IDS after "Android;" | ||
// up to "Build" or ") AppleWebKit". | ||
// Example: | ||
// "Mozilla/5.0 (Linux; Android 8.1.0; Moto G (5) Plus) AppleWebKit/537.36 | ||
// (KHTML, like Gecko) Chrome/70.0.3538.80 Mobile Safari/537.36" | ||
if (/\bAndroid\b/.test(os) && !product && | ||
(data = /\bAndroid[^;]*;(.*?)(?:Build|\) AppleWebKit)\b/i.exec(ua))) { | ||
product = trim(data[1]) | ||
// Replace any language codes (eg. "en-US"). | ||
.replace(/^[a-z]{2}-[a-z]{2};\s*/i, '') | ||
|| null; | ||
} | ||
// Detect product names that contain their manufacturer's name. | ||
if (manufacturer && !product) { | ||
product = getProduct([manufacturer]); | ||
} else if (manufacturer && product) { | ||
product = product | ||
.replace(RegExp('^(' + qualify(manufacturer) + ')[-_.\\s]', 'i'), manufacturer + ' ') | ||
.replace(RegExp('^(' + qualify(manufacturer) + ')[-_.]?(\\w)', 'i'), manufacturer + ' $2'); | ||
} | ||
@@ -658,3 +687,3 @@ // Clean up Google TV. | ||
// Detect Kubuntu. | ||
else if (name == 'Konqueror' && !/buntu/i.test(os)) { | ||
else if (name == 'Konqueror' && /^Linux\b/i.test(os)) { | ||
os = 'Kubuntu'; | ||
@@ -679,2 +708,6 @@ } | ||
} | ||
// Detect UC Browser speed mode. | ||
else if (name == 'UC Browser' && /\bUCWEB\b/.test(ua)) { | ||
description.push('speed mode'); | ||
} | ||
// Detect PaleMoon identifying as Firefox. | ||
@@ -709,3 +742,3 @@ else if (name == 'PaleMoon' && (data = /\bFirefox\/([\d.]+)\b/.exec(ua))) { | ||
version = getVersion([ | ||
'(?:Cloud9|CriOS|CrMo|Edge|FxiOS|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|SamsungBrowser|Silk(?!/[\\d.]+$))', | ||
'(?:Cloud9|CriOS|CrMo|Edge|Edg|EdgA|EdgiOS|FxiOS|HeadlessChrome|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|SamsungBrowser|Silk(?!/[\\d.]+$)|UCBrowser|YaBrowser)', | ||
'Version', | ||
@@ -838,3 +871,3 @@ qualify(name), | ||
// Detect Firefox Mobile. | ||
if (name == 'Fennec' || name == 'Firefox' && /\b(?:Android|Firefox OS)\b/.test(os)) { | ||
if (name == 'Fennec' || name == 'Firefox' && /\b(?:Android|Firefox OS|KaiOS)\b/.test(os)) { | ||
name = 'Firefox Mobile'; | ||
@@ -935,3 +968,3 @@ } | ||
// Use the full Chrome version when available. | ||
data[1] = (/\bChrome\/([\d.]+)/i.exec(ua) || 0)[1]; | ||
data[1] = (/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(ua) || 0)[1]; | ||
// Detect Blink layout engine. | ||
@@ -945,3 +978,3 @@ if (data[0] == 537.36 && data[2] == 537.36 && parseFloat(data[1]) >= 28 && layout == 'WebKit') { | ||
layout && (layout[1] = 'like Safari'); | ||
data = (data = data[0], data < 400 ? 1 : data < 500 ? 2 : data < 526 ? 3 : data < 533 ? 4 : data < 534 ? '4+' : data < 535 ? 5 : data < 537 ? 6 : data < 538 ? 7 : data < 601 ? 8 : '8'); | ||
data = (data = data[0], data < 400 ? 1 : data < 500 ? 2 : data < 526 ? 3 : data < 533 ? 4 : data < 534 ? '4+' : data < 535 ? 5 : data < 537 ? 6 : data < 538 ? 7 : data < 601 ? 8 : data < 602 ? 9 : data < 604 ? 10 : data < 606 ? 11 : data < 608 ? 12 : '12'); | ||
} else { | ||
@@ -956,2 +989,4 @@ layout && (layout[1] = 'like Chrome'); | ||
version = data; | ||
} else if (name == 'Chrome' && /\bHeadlessChrome/i.test(ua)) { | ||
description.unshift('headless'); | ||
} | ||
@@ -984,2 +1019,6 @@ } | ||
} | ||
// Newer versions of SRWare Iron uses the Chrome tag to indicate its version number. | ||
else if (/\bSRWare Iron\b/.test(name) && !version) { | ||
version = getVersion('Chrome'); | ||
} | ||
// Strip incorrect OS versions. | ||
@@ -990,2 +1029,6 @@ if (version && version.indexOf((data = /[\d.]+$/.exec(os))) == 0 && | ||
} | ||
// Ensure OS does not include the browser name. | ||
if (os && os.indexOf(name) != -1 && !RegExp(name + ' OS').test(os)) { | ||
os = os.replace(RegExp(' *' + qualify(name) + ' *'), ''); | ||
} | ||
// Add layout engine. | ||
@@ -995,3 +1038,3 @@ if (layout && !/\b(?:Avant|Nook)\b/.test(name) && ( | ||
name != 'Safari' && /^iOS/.test(os) && /\bSafari\b/.test(layout[1]) || | ||
/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|Web)/.test(name) && layout[1])) { | ||
/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(name) && layout[1])) { | ||
// Don't add layout details to description if they are falsey. | ||
@@ -1165,4 +1208,4 @@ (data = layout[layout.length - 1]) && description.push(data); | ||
* "Windows", "Windows Server 2008 R2 / 7", "Windows Server 2008 / Vista", | ||
* "Windows XP", "OS X", "Ubuntu", "Debian", "Fedora", "Red Hat", "SuSE", | ||
* "Android", "iOS" and "Windows Phone" | ||
* "Windows XP", "OS X", "Linux", "Ubuntu", "Debian", "Fedora", "Red Hat", | ||
* "SuSE", "Android", "iOS" and "Windows Phone" | ||
* | ||
@@ -1169,0 +1212,0 @@ * @memberOf platform.os |
@@ -7,3 +7,3 @@ # Platform.js v1.3.5 | ||
Platform.js is for informational purposes only & **not** intended as a substitution for [feature detection/inference](http://allyoucanleet.com/post/18087210413/feature-testing-costs#screencast2) checks. | ||
Platform.js is for informational purposes only & **not** intended as a substitution for feature detection/inference checks. | ||
@@ -15,2 +15,3 @@ ## Documentation | ||
* [wiki/Roadmap](https://github.com/bestiejs/platform.js/wiki/Roadmap) | ||
* [platform.js demo](https://bestiejs.github.io/platform.js/) (See also [whatsmyua.info](https://www.whatsmyua.info/) for comparisons between platform.js and other platform detection libraries) | ||
@@ -73,3 +74,3 @@ ## Installation | ||
Tested in Chrome 62-63, Firefox 56-57, IE 11, Edge 15-16, Safari 10-11, Node.js 4-8, & PhantomJS 2.1.1. | ||
Tested in Chrome 82-83, Firefox 77-78, IE 11, Edge 82-83, Safari 12-13, Node.js 4-14, & PhantomJS 2.1.1. | ||
@@ -76,0 +77,0 @@ ## BestieJS |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
47052
1169
77
5