Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

device-detector

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

device-detector - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

32

dist/DeviceDetector.js
/**
* device-detector@1.0.1
* built on: Mon, 07 Aug 2017 07:23:54 GMT
* device-detector@1.0.2
* built on: Wed, 06 Dec 2017 05:26:41 GMT
* repository: git@github.com:ndaidong/device-detector.git

@@ -60,11 +60,18 @@ * maintainer: @ndaidong

re.type = function () {
var t = 'Desktop';
if (detect(/(iphone|ipod|((?:android)?.*?mobile)|j2me|mobi|blackberry|nokia|maemo|mini)/i)) {
t = 'Mobile';
} else if (detect(/(ipad|android(?!.*mobile))/i) || detect(/\W(kindle|silk|tablet)\W/i)) {
t = 'Tablet';
} else if (detect(/(bot|crawler|spider|slurp|seeker)/i)) {
t = 'Bot';
} else if (detect(/(fetcher|scan|valid|check|news|engine)/i)) {
t = 'Util';
var t = void 0;
switch (true) {
case detect(/(ipad|android(?!.*mobile))/i) || detect(/\W(kindle|silk|tablet)\W/i):
t = 'Tablet';
break;
case detect(/(iphone|ipod|((?:android)?.*?mobile)|j2me|mobi|blackberry|nokia|maemo|mini)/i):
t = 'Mobile';
break;
case detect(/(bot|crawler|spider|slurp|seeker)/i):
t = 'Bot';
break;
case detect(/(fetcher|scan|valid|check|news|engine)/i):
t = 'Util';
break;
default:
t = 'Desktop';
}

@@ -132,2 +139,5 @@ return t;

b = 'Opera Mini';
if (re.os === 'Android' && re.type === 'Tablet') {
re.type = 'Unknown';
}
} else if (isOpera) {

@@ -134,0 +144,0 @@ b = 'Opera';

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

// device-detector@1.0.1, by @ndaidong - built on Mon, 07 Aug 2017 07:23:54 GMT - published under MIT license
!function(e,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i(e.DeviceDetector={})}(this,function(e){"use strict";e.parse=function(){var e={type:"Unknown",browser:"",engine:"",version:"",os:""},i=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!i&&"undefined"!=typeof window&&window.navigator&&(i=window.navigator.userAgent),!i)return e;var o=i.toLowerCase();e.userAgent=i;var r=function(e){return e.test(o)},n=r(/chrome/i),t=r(/safari/i),a=r(/firefox/i),s=r(/vivaldi/i),p=r(/opera/i),l=r(/opera mini/i),d=r(/edge/),f=r(/msie/i),b=r(/midori/i),c=r(/maxthon/i),u=r(/netscape/i),m=r(/konqueror/i),w=r(/minefield/i),g=r(/omniweb/i),v=r(/ucbrowser/),y=r(/webkit/i),k=r(/gecko/i),h=r(/presto/i),x=r(/trident/i),B=r(/avant browser/i),_=r(/seamonkey/i),S=r(/deepnet/i),M=r(/dorothy/i),O=r(/fennec/i),G=r(/maemo/i);e.type=function(){var e="Desktop";return r(/(iphone|ipod|((?:android)?.*?mobile)|j2me|mobi|blackberry|nokia|maemo|mini)/i)?e="Mobile":r(/(ipad|android(?!.*mobile))/i)||r(/\W(kindle|silk|tablet)\W/i)?e="Tablet":r(/(bot|crawler|spider|slurp|seeker)/i)?e="Bot":r(/(fetcher|scan|valid|check|news|engine)/i)&&(e="Util"),e}(),e.os=function(){var i="";return"Bot"===e.type||"Util"===e.type?i:(r(/android/i)?i="Android":r(/(ipad|iphone|ipod)/i)?i="iOS":r(/(blackberry)/i)?i="BlackBerry":r(/(symbos|symbian|nokia|maemo)/i)?i="SymbianOS":r(/linux/i)?i="Linux":r(/mac/i)?i="Mac":r(/iemobile/i)?i="WindowsPhone":r(/win/i)?i=r(/windows nt/i)?"Windows NT":"Windows":r(/cros/i)&&(i="ChromeOS"),i)}(),e.browser=function(){var i="";return"Bot"===e.type||"Util"===e.type?i:(!y||!n||b||s||d||v?w?i="Minefield":k&&a&&!O&&!G?i="Firefox":!y||!t||n||b||g||v||s||c||M?S?i="Deepnet Explorer":g?i="OmniWeb":v?i="UCBrowser":m?i="Konqueror":c?i="Maxthon":s?i="Vivaldi":b?i="Midori":l?i="Opera Mini":p?i="Opera":d?i="Edge":B?i="Avant Browser":_?i="SeaMonkey":r(/iemobile/i)?i="IEMobile":!f||p||s?M?i="Dorothy Browser":O?i="Fennec":G?i="Maemo Browser":u&&(i="Netscape"):i="MSIE":i="Safari":i="Chrome",i||"SymbianOS"===e.os&&(i=r(/doris/i)?"Doris":r(/gobrowser/)?"GoBrowser":"Nokia Browser"),i)}(),e.engine=function(){var i="";return"Bot"===e.type||"Util"===e.type?r(/google/i)?i=r(/image/i)?"Googlebot-Image":r(/feedfetcher/i)?"Feedfetcher-Google":r(/appengine/i)?"AppEngine-Google":"Googlebot":r(/bing/i)?i="Bingbot":r(/baidu/i)?i="BaiduSpider":r(/yandexbot/i)?i="YandexBot":r(/yandeximages/i)?i="YandexImages":r(/yahoo/i)?i=r(/yahooseeker/i)?"YahooSeeker":"Yahoo! Slurp":r(/soso/i)?i="Sosospider":r(/exabot/i)?i="Exabot":r(/sogou/i)?i="Sogou Spider":r(/newsgator/i)&&(i="NewsGator"):y?i="Webkit":k?i="Gecko":x?i="Trident":h&&(i="Presto"),i}();return e.version=function(){var i="Bot"===e.type||"Util"===e.type?e.engine:e.browser,r="";if(S)r=function(){for(var e="",i=o.split(";"),r=0;r<i.length;r++){var n=i[r];if(/deepnet explorer/.test(n)){e=n.replace(/[^0-9.]/gi,"");break}}return e}();else if("YahooSeeker"===i)r=o.split(" ")[0].replace("yahooseeker/","");else if(B||f)r=function(){for(var e="",i=o.split(";"),r=0;r<i.length;r++){var n=i[r];if(/msie/.test(n)){e=n.replace(/[^0-9.]/gi,"");break}}return e}();else if("Nokia Browser"===e.browser)r=function(){var e=o.split("symbianos/");return e[1]?parseFloat(e[1]):""}();else if("GoBrowser"===e.browser)r=function(){var e=o.split("gobrowser/");return e[1]?parseFloat(e[1]):""}();else{var n=i.toLowerCase(),t=n,a=o.replace(t,"________").split(" ");"safari"===n||M?n="version/":n+="/";for(var s=0;s<a.length;s++){var p=a[s].replace("________",t);if(-1!==p.indexOf(n)){var l=p.split("/");l.length>1&&(r=l[1]);break}}}return r.indexOf(";")&&(r=r.split(";")[0]),r}(),e},Object.defineProperty(e,"__esModule",{value:!0})});
// device-detector@1.0.2, by @ndaidong - built on Wed, 06 Dec 2017 05:26:41 GMT - published under MIT license
!function(e,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i(e.DeviceDetector={})}(this,function(e){"use strict";e.parse=function(){var e={type:"Unknown",browser:"",engine:"",version:"",os:""},i=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!i&&"undefined"!=typeof window&&window.navigator&&(i=window.navigator.userAgent),!i)return e;var o=i.toLowerCase();e.userAgent=i;var r=function(e){return e.test(o)},n=r(/chrome/i),t=r(/safari/i),a=r(/firefox/i),s=r(/vivaldi/i),d=r(/opera/i),p=r(/opera mini/i),l=r(/edge/),f=r(/msie/i),b=r(/midori/i),c=r(/maxthon/i),u=r(/netscape/i),w=r(/konqueror/i),m=r(/minefield/i),g=r(/omniweb/i),y=r(/ucbrowser/),v=r(/webkit/i),k=r(/gecko/i),h=r(/presto/i),x=r(/trident/i),B=r(/avant browser/i),_=r(/seamonkey/i),S=r(/deepnet/i),M=r(/dorothy/i),O=r(/fennec/i),G=r(/maemo/i);e.type=function(){var e=void 0;switch(!0){case r(/(ipad|android(?!.*mobile))/i)||r(/\W(kindle|silk|tablet)\W/i):e="Tablet";break;case r(/(iphone|ipod|((?:android)?.*?mobile)|j2me|mobi|blackberry|nokia|maemo|mini)/i):e="Mobile";break;case r(/(bot|crawler|spider|slurp|seeker)/i):e="Bot";break;case r(/(fetcher|scan|valid|check|news|engine)/i):e="Util";break;default:e="Desktop"}return e}(),e.os=function(){var i="";return"Bot"===e.type||"Util"===e.type?i:(r(/android/i)?i="Android":r(/(ipad|iphone|ipod)/i)?i="iOS":r(/(blackberry)/i)?i="BlackBerry":r(/(symbos|symbian|nokia|maemo)/i)?i="SymbianOS":r(/linux/i)?i="Linux":r(/mac/i)?i="Mac":r(/iemobile/i)?i="WindowsPhone":r(/win/i)?i=r(/windows nt/i)?"Windows NT":"Windows":r(/cros/i)&&(i="ChromeOS"),i)}(),e.browser=function(){var i="";return"Bot"===e.type||"Util"===e.type?i:(!v||!n||b||s||l||y?m?i="Minefield":k&&a&&!O&&!G?i="Firefox":!v||!t||n||b||g||y||s||c||M?S?i="Deepnet Explorer":g?i="OmniWeb":y?i="UCBrowser":w?i="Konqueror":c?i="Maxthon":s?i="Vivaldi":b?i="Midori":p?(i="Opera Mini","Android"===e.os&&"Tablet"===e.type&&(e.type="Unknown")):d?i="Opera":l?i="Edge":B?i="Avant Browser":_?i="SeaMonkey":r(/iemobile/i)?i="IEMobile":!f||d||s?M?i="Dorothy Browser":O?i="Fennec":G?i="Maemo Browser":u&&(i="Netscape"):i="MSIE":i="Safari":i="Chrome",i||"SymbianOS"===e.os&&(i=r(/doris/i)?"Doris":r(/gobrowser/)?"GoBrowser":"Nokia Browser"),i)}(),e.engine=function(){var i="";return"Bot"===e.type||"Util"===e.type?r(/google/i)?i=r(/image/i)?"Googlebot-Image":r(/feedfetcher/i)?"Feedfetcher-Google":r(/appengine/i)?"AppEngine-Google":"Googlebot":r(/bing/i)?i="Bingbot":r(/baidu/i)?i="BaiduSpider":r(/yandexbot/i)?i="YandexBot":r(/yandeximages/i)?i="YandexImages":r(/yahoo/i)?i=r(/yahooseeker/i)?"YahooSeeker":"Yahoo! Slurp":r(/soso/i)?i="Sosospider":r(/exabot/i)?i="Exabot":r(/sogou/i)?i="Sogou Spider":r(/newsgator/i)&&(i="NewsGator"):v?i="Webkit":k?i="Gecko":x?i="Trident":h&&(i="Presto"),i}();return e.version=function(){var i="Bot"===e.type||"Util"===e.type?e.engine:e.browser,r="";if(S)r=function(){for(var e="",i=o.split(";"),r=0;r<i.length;r++){var n=i[r];if(/deepnet explorer/.test(n)){e=n.replace(/[^0-9.]/gi,"");break}}return e}();else if("YahooSeeker"===i)r=o.split(" ")[0].replace("yahooseeker/","");else if(B||f)r=function(){for(var e="",i=o.split(";"),r=0;r<i.length;r++){var n=i[r];if(/msie/.test(n)){e=n.replace(/[^0-9.]/gi,"");break}}return e}();else if("Nokia Browser"===e.browser)r=function(){var e=o.split("symbianos/");return e[1]?parseFloat(e[1]):""}();else if("GoBrowser"===e.browser)r=function(){var e=o.split("gobrowser/");return e[1]?parseFloat(e[1]):""}();else{var n=i.toLowerCase(),t=n,a=o.replace(t,"________").split(" ");"safari"===n||M?n="version/":n+="/";for(var s=0;s<a.length;s++){var d=a[s].replace("________",t);if(-1!==d.indexOf(n)){var p=d.split("/");p.length>1&&(r=p[1]);break}}}return r.indexOf(";")&&(r=r.split(";")[0]),r}(),e},Object.defineProperty(e,"__esModule",{value:!0})});
{
"version": "1.0.1",
"version": "1.0.2",
"name": "device-detector",
"description": "Detect device info on Node.js and Browser",
"homepage": "http://techpush.net",
"homepage": "https://www.npmjs.com/package/device-detector",
"repository": {

@@ -7,0 +7,0 @@ "type": "git",

@@ -62,11 +62,18 @@ /**

re.type = (() => {
let t = 'Desktop';
if (detect(/(iphone|ipod|((?:android)?.*?mobile)|j2me|mobi|blackberry|nokia|maemo|mini)/i)) {
t = 'Mobile';
} else if (detect(/(ipad|android(?!.*mobile))/i) || detect(/\W(kindle|silk|tablet)\W/i)) {
t = 'Tablet';
} else if (detect(/(bot|crawler|spider|slurp|seeker)/i)) {
t = 'Bot';
} else if (detect(/(fetcher|scan|valid|check|news|engine)/i)) {
t = 'Util';
let t;
switch (true) {
case detect(/(ipad|android(?!.*mobile))/i) || detect(/\W(kindle|silk|tablet)\W/i):
t = 'Tablet';
break;
case detect(/(iphone|ipod|((?:android)?.*?mobile)|j2me|mobi|blackberry|nokia|maemo|mini)/i):
t = 'Mobile';
break;
case detect(/(bot|crawler|spider|slurp|seeker)/i):
t = 'Bot';
break;
case detect(/(fetcher|scan|valid|check|news|engine)/i):
t = 'Util';
break;
default:
t = 'Desktop';
}

@@ -125,3 +132,3 @@ return t;

} else if (isWebkit && isSafari && !isChrome && !isMidori && !isOmniWeb &&
!isUCBrowser && !isVivaldi && !isMaxthon && !isDorothy) {
!isUCBrowser && !isVivaldi && !isMaxthon && !isDorothy) {
b = 'Safari';

@@ -144,2 +151,5 @@ } else if (isDeepnetExplorer) {

b = 'Opera Mini';
if (re.os === 'Android' && re.type === 'Tablet') {
re.type = 'Unknown';
}
} else if (isOpera) {

@@ -146,0 +156,0 @@ b = 'Opera';

@@ -20,3 +20,3 @@ /**

ex: {
type: 'Mobile',
type: 'Unknown',
browser: 'Opera Mini',

@@ -23,0 +23,0 @@ engine: 'Presto',

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