Socket
Socket
Sign inDemoInstall

current-device

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

current-device - npm Package Compare versions

Comparing version 0.7.2 to 0.7.5

8

es/index.js

@@ -130,2 +130,5 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

device.portrait = function () {
if (Object.prototype.hasOwnProperty.call(window, 'onorientationchange')) {
return screen.orientation.type.includes('portrait');
}
return window.innerHeight / window.innerWidth > 1;

@@ -135,2 +138,5 @@ };

device.landscape = function () {
if (Object.prototype.hasOwnProperty.call(window, 'onorientationchange')) {
return screen.orientation.type.includes('landscape');
}
return window.innerHeight / window.innerWidth < 1;

@@ -266,3 +272,3 @@ };

if (Object.prototype.hasOwnProperty.call(window, 'onorientationchange')) {
orientationEvent = 'onorientationchange';
orientationEvent = 'orientationchange';
}

@@ -269,0 +275,0 @@

@@ -134,2 +134,5 @@ 'use strict';

device.portrait = function () {
if (Object.prototype.hasOwnProperty.call(window, 'onorientationchange')) {
return screen.orientation.type.includes('portrait');
}
return window.innerHeight / window.innerWidth > 1;

@@ -139,2 +142,5 @@ };

device.landscape = function () {
if (Object.prototype.hasOwnProperty.call(window, 'onorientationchange')) {
return screen.orientation.type.includes('landscape');
}
return window.innerHeight / window.innerWidth < 1;

@@ -270,3 +276,3 @@ };

if (Object.prototype.hasOwnProperty.call(window, 'onorientationchange')) {
orientationEvent = 'onorientationchange';
orientationEvent = 'orientationchange';
}

@@ -273,0 +279,0 @@

19

package.json
{
"name": "current-device",
"version": "0.7.2",
"version": "0.7.5",
"homepage": "https://github.com/matthewhudson/current-device",
"description":
"The easiest way to write conditional CSS and/or JavaScript based on device operating system (iOS, Android, Blackberry, Windows, Firefox OS, MeeGo, AppleTV, etc), orientation (Portrait vs. Landscape), and type (Tablet vs. Mobile).",
"description": "The easiest way to write conditional CSS and/or JavaScript based on device operating system (iOS, Android, Blackberry, Windows, Firefox OS, MeeGo, AppleTV, etc), orientation (Portrait vs. Landscape), and type (Tablet vs. Mobile).",
"main": "lib/index.js",
"module": "es/index.js",
"files": ["es", "lib", "umd"],
"files": [
"es",
"lib",
"umd"
],
"scripts": {

@@ -20,6 +23,6 @@ "build": "nwb build-web-module",

"devDependencies": {
"eslint": "4.12.1",
"eslint-plugin-import": "2.8.0",
"nwb": "0.20.0",
"prettier": "1.8.2"
"eslint": "4.19.1",
"eslint-plugin-import": "2.11.0",
"nwb": "0.21.5",
"prettier": "1.12.1"
},

@@ -26,0 +29,0 @@ "author": {

/*!
* current-device v0.7.2 - https://github.com/matthewhudson/current-device
* current-device v0.7.4 - https://github.com/matthewhudson/current-device
* MIT Licensed

@@ -14,3 +14,3 @@ */

root["device"] = factory();
})(this, function() {
})(typeof self !== 'undefined' ? self : this, function() {
return /******/ (function(modules) { // webpackBootstrap

@@ -223,2 +223,5 @@ /******/ // The module cache

device.portrait = function () {
if (Object.prototype.hasOwnProperty.call(window, 'onorientationchange')) {
return screen.orientation.type.includes('portrait');
}
return window.innerHeight / window.innerWidth > 1;

@@ -228,2 +231,5 @@ };

device.landscape = function () {
if (Object.prototype.hasOwnProperty.call(window, 'onorientationchange')) {
return screen.orientation.type.includes('landscape');
}
return window.innerHeight / window.innerWidth < 1;

@@ -359,3 +365,3 @@ };

if (Object.prototype.hasOwnProperty.call(window, 'onorientationchange')) {
orientationEvent = 'onorientationchange';
orientationEvent = 'orientationchange';
}

@@ -398,3 +404,3 @@

/***/ })
/******/ ]);
/******/ ])["default"];
});
/*!
* current-device v0.7.2 - https://github.com/matthewhudson/current-device
* current-device v0.7.4 - https://github.com/matthewhudson/current-device
* MIT Licensed
*/
!function(n,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports.device=o():n.device=o()}(this,function(){return function(n){function o(t){if(e[t])return e[t].exports;var i=e[t]={i:t,l:!1,exports:{}};return n[t].call(i.exports,i,i.exports,o),i.l=!0,i.exports}var e={};return o.m=n,o.c=e,o.d=function(n,e,t){o.o(n,e)||Object.defineProperty(n,e,{configurable:!1,enumerable:!0,get:t})},o.n=function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return o.d(e,"a",e),e},o.o=function(n,o){return Object.prototype.hasOwnProperty.call(n,o)},o.p="",o(o.s=0)}([function(n,o,e){n.exports=e(1)},function(n,o,e){"use strict";function t(n){return-1!==m.indexOf(n)}function i(n){return w.className.match(new RegExp(n,"i"))}function r(n){var o=null;i(n)||(o=w.className.replace(/^\s+|\s+$/g,""),w.className=o+" "+n)}function a(n){i(n)&&(w.className=w.className.replace(" "+n,""))}function d(){b.landscape()?(a("portrait"),r("landscape"),c("landscape")):(a("landscape"),r("portrait"),c("portrait")),l()}function c(n){for(var o in p)p[o](n)}function u(n){for(var o=0;o<n.length;o++)if(b[n[o]]())return n[o];return"unknown"}function l(){b.orientation=u(["portrait","landscape"])}Object.defineProperty(o,"__esModule",{value:!0});var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},f=window.device,b={},p=[];window.device=b;var w=window.document.documentElement,m=window.navigator.userAgent.toLowerCase(),v=["googletv","viera","smarttv","internet.tv","netcast","nettv","appletv","boxee","kylo","roku","dlnadoc","roku","pov_tv","hbbtv","ce-html"];b.macos=function(){return t("mac")},b.ios=function(){return b.iphone()||b.ipod()||b.ipad()},b.iphone=function(){return!b.windows()&&t("iphone")},b.ipod=function(){return t("ipod")},b.ipad=function(){return t("ipad")},b.android=function(){return!b.windows()&&t("android")},b.androidPhone=function(){return b.android()&&t("mobile")},b.androidTablet=function(){return b.android()&&!t("mobile")},b.blackberry=function(){return t("blackberry")||t("bb10")||t("rim")},b.blackberryPhone=function(){return b.blackberry()&&!t("tablet")},b.blackberryTablet=function(){return b.blackberry()&&t("tablet")},b.windows=function(){return t("windows")},b.windowsPhone=function(){return b.windows()&&t("phone")},b.windowsTablet=function(){return b.windows()&&t("touch")&&!b.windowsPhone()},b.fxos=function(){return(t("(mobile")||t("(tablet"))&&t(" rv:")},b.fxosPhone=function(){return b.fxos()&&t("mobile")},b.fxosTablet=function(){return b.fxos()&&t("tablet")},b.meego=function(){return t("meego")},b.cordova=function(){return window.cordova&&"file:"===location.protocol},b.nodeWebkit=function(){return"object"===s(window.process)},b.mobile=function(){return b.androidPhone()||b.iphone()||b.ipod()||b.windowsPhone()||b.blackberryPhone()||b.fxosPhone()||b.meego()},b.tablet=function(){return b.ipad()||b.androidTablet()||b.blackberryTablet()||b.windowsTablet()||b.fxosTablet()},b.desktop=function(){return!b.tablet()&&!b.mobile()},b.television=function(){for(var n=0;n<v.length;){if(t(v[n]))return!0;n++}return!1},b.portrait=function(){return window.innerHeight/window.innerWidth>1},b.landscape=function(){return window.innerHeight/window.innerWidth<1},b.noConflict=function(){return window.device=f,this},b.ios()?b.ipad()?r("ios ipad tablet"):b.iphone()?r("ios iphone mobile"):b.ipod()&&r("ios ipod mobile"):b.macos()?r("macos desktop"):b.android()?r(b.androidTablet()?"android tablet":"android mobile"):b.blackberry()?r(b.blackberryTablet()?"blackberry tablet":"blackberry mobile"):b.windows()?r(b.windowsTablet()?"windows tablet":b.windowsPhone()?"windows mobile":"windows desktop"):b.fxos()?r(b.fxosTablet()?"fxos tablet":"fxos mobile"):b.meego()?r("meego mobile"):b.nodeWebkit()?r("node-webkit"):b.television()?r("television"):b.desktop()&&r("desktop"),b.cordova()&&r("cordova"),b.onChangeOrientation=function(n){"function"==typeof n&&p.push(n)};var y="resize";Object.prototype.hasOwnProperty.call(window,"onorientationchange")&&(y="onorientationchange"),window.addEventListener?window.addEventListener(y,d,!1):window.attachEvent?window.attachEvent(y,d):window[y]=d,d(),b.type=u(["mobile","tablet","desktop"]),b.os=u(["ios","iphone","ipad","ipod","android","blackberry","windows","fxos","meego","television"]),l(),o.default=b}])});
!function(n,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.device=e():n.device=e()}("undefined"!=typeof self?self:this,function(){return function(n){var e={};function o(t){if(e[t])return e[t].exports;var i=e[t]={i:t,l:!1,exports:{}};return n[t].call(i.exports,i,i.exports,o),i.l=!0,i.exports}return o.m=n,o.c=e,o.d=function(n,e,t){o.o(n,e)||Object.defineProperty(n,e,{configurable:!1,enumerable:!0,get:t})},o.n=function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return o.d(e,"a",e),e},o.o=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},o.p="",o(o.s=0)}([function(n,e,o){n.exports=o(1)},function(n,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},i=window.device,r={},a=[];window.device=r;var c=window.document.documentElement,d=window.navigator.userAgent.toLowerCase(),u=["googletv","viera","smarttv","internet.tv","netcast","nettv","appletv","boxee","kylo","roku","dlnadoc","roku","pov_tv","hbbtv","ce-html"];function l(n){return-1!==d.indexOf(n)}function s(n){return c.className.match(new RegExp(n,"i"))}function f(n){var e=null;s(n)||(e=c.className.replace(/^\s+|\s+$/g,""),c.className=e+" "+n)}function b(n){s(n)&&(c.className=c.className.replace(" "+n,""))}function p(){r.landscape()?(b("portrait"),f("landscape"),w("landscape")):(b("landscape"),f("portrait"),w("portrait")),h()}function w(n){for(var e in a)a[e](n)}r.macos=function(){return l("mac")},r.ios=function(){return r.iphone()||r.ipod()||r.ipad()},r.iphone=function(){return!r.windows()&&l("iphone")},r.ipod=function(){return l("ipod")},r.ipad=function(){return l("ipad")},r.android=function(){return!r.windows()&&l("android")},r.androidPhone=function(){return r.android()&&l("mobile")},r.androidTablet=function(){return r.android()&&!l("mobile")},r.blackberry=function(){return l("blackberry")||l("bb10")||l("rim")},r.blackberryPhone=function(){return r.blackberry()&&!l("tablet")},r.blackberryTablet=function(){return r.blackberry()&&l("tablet")},r.windows=function(){return l("windows")},r.windowsPhone=function(){return r.windows()&&l("phone")},r.windowsTablet=function(){return r.windows()&&l("touch")&&!r.windowsPhone()},r.fxos=function(){return(l("(mobile")||l("(tablet"))&&l(" rv:")},r.fxosPhone=function(){return r.fxos()&&l("mobile")},r.fxosTablet=function(){return r.fxos()&&l("tablet")},r.meego=function(){return l("meego")},r.cordova=function(){return window.cordova&&"file:"===location.protocol},r.nodeWebkit=function(){return"object"===t(window.process)},r.mobile=function(){return r.androidPhone()||r.iphone()||r.ipod()||r.windowsPhone()||r.blackberryPhone()||r.fxosPhone()||r.meego()},r.tablet=function(){return r.ipad()||r.androidTablet()||r.blackberryTablet()||r.windowsTablet()||r.fxosTablet()},r.desktop=function(){return!r.tablet()&&!r.mobile()},r.television=function(){for(var n=0;n<u.length;){if(l(u[n]))return!0;n++}return!1},r.portrait=function(){return Object.prototype.hasOwnProperty.call(window,"onorientationchange")?screen.orientation.type.includes("portrait"):window.innerHeight/window.innerWidth>1},r.landscape=function(){return Object.prototype.hasOwnProperty.call(window,"onorientationchange")?screen.orientation.type.includes("landscape"):window.innerHeight/window.innerWidth<1},r.noConflict=function(){return window.device=i,this},r.ios()?r.ipad()?f("ios ipad tablet"):r.iphone()?f("ios iphone mobile"):r.ipod()&&f("ios ipod mobile"):r.macos()?f("macos desktop"):r.android()?r.androidTablet()?f("android tablet"):f("android mobile"):r.blackberry()?r.blackberryTablet()?f("blackberry tablet"):f("blackberry mobile"):r.windows()?r.windowsTablet()?f("windows tablet"):r.windowsPhone()?f("windows mobile"):f("windows desktop"):r.fxos()?r.fxosTablet()?f("fxos tablet"):f("fxos mobile"):r.meego()?f("meego mobile"):r.nodeWebkit()?f("node-webkit"):r.television()?f("television"):r.desktop()&&f("desktop"),r.cordova()&&f("cordova"),r.onChangeOrientation=function(n){"function"==typeof n&&a.push(n)};var m="resize";function y(n){for(var e=0;e<n.length;e++)if(r[n[e]]())return n[e];return"unknown"}function h(){r.orientation=y(["portrait","landscape"])}Object.prototype.hasOwnProperty.call(window,"onorientationchange")&&(m="orientationchange"),window.addEventListener?window.addEventListener(m,p,!1):window.attachEvent?window.attachEvent(m,p):window[m]=p,p(),r.type=y(["mobile","tablet","desktop"]),r.os=y(["ios","iphone","ipad","ipod","android","blackberry","windows","fxos","meego","television"]),h(),e.default=r}]).default});
//# sourceMappingURL=current-device.min.js.map

Sorry, the diff of this file is not supported yet

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