Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

detect-it

Package Overview
Dependencies
4
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.0 to 3.0.1

13

lib/index.js

@@ -107,2 +107,15 @@ 'use strict';

'mouse';
// issue with Windows Chrome on hybrid devices starting in version 59 where
// media queries represent a touch only device, so if the browser is an
// affected Windows Chrome version and hasTouch,
// then assume it's a hybrid with primaryInput mouse
// see https://github.com/rafrex/detect-it/issues/8
var isAffectedWindowsChromeVersion = /windows/.test(window.navigator.userAgent.toLowerCase()) && /chrome/.test(window.navigator.userAgent.toLowerCase()) && parseInt(/Chrome\/([0-9.]+)/.exec(navigator.userAgent)[1], 10) >= 59;
if (isAffectedWindowsChromeVersion && detectIt.hasTouch) {
detectIt.deviceType = 'hybrid';
detectIt.hasMouse = true;
detectIt.primaryInput = 'mouse';
}
}

@@ -109,0 +122,0 @@ }

6

package.json
{
"name": "detect-it",
"version": "3.0.0",
"version": "3.0.1",
"description": "Detect if a device is mouse only, touch only, or hybrid",

@@ -8,4 +8,4 @@ "main": "lib/index.js",

"build": "rm -rf lib && babel src -d lib --presets=env",
"prepublish": "npm run build",
"dev": "npm link && babel src -d lib --watch --presets=env"
"prepublish": "yarn build",
"dev": "yarn link && babel src -d lib --watch --presets=env"
},

@@ -12,0 +12,0 @@ "files": [

@@ -37,2 +37,4 @@ # Detect It

```terminal
$ yarn add detect-it
# OR
$ npm install --save detect-it

@@ -39,0 +41,0 @@ ```

@@ -90,2 +90,18 @@ import detectHover from 'detect-hover';

'mouse';
// issue with Windows Chrome on hybrid devices starting in version 59 where
// media queries represent a touch only device, so if the browser is an
// affected Windows Chrome version and hasTouch,
// then assume it's a hybrid with primaryInput mouse
// see https://github.com/rafrex/detect-it/issues/8
const isAffectedWindowsChromeVersion =
/windows/.test(window.navigator.userAgent.toLowerCase()) &&
/chrome/.test(window.navigator.userAgent.toLowerCase()) &&
parseInt(/Chrome\/([0-9.]+)/.exec(navigator.userAgent)[1], 10) >= 59;
if (isAffectedWindowsChromeVersion && detectIt.hasTouch) {
detectIt.deviceType = 'hybrid';
detectIt.hasMouse = true;
detectIt.primaryInput = 'mouse';
}
}

@@ -92,0 +108,0 @@ },

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