New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

use-mobile-detect-hook

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

use-mobile-detect-hook - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

2

package.json
{
"name": "use-mobile-detect-hook",
"version": "1.0.2",
"version": "1.0.3",
"description": "The React hook to detect if the device is mobile or desktop.",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -8,5 +8,6 @@ const { useEffect } = require('react');

const isWindows = () => Boolean(userAgent.match(/IEMobile/i));
const isSSR = () => Boolean(userAgent.match(/SSR/i));
const isMobile = () => Boolean(isAndroid() || isIos() || isOpera() || isWindows());
const isDesktop = () => !isMobile();
const isDesktop = () => Boolean(!isMobile() && !isSSR());
return {

@@ -16,3 +17,4 @@ isMobile,

isAndroid,
isIos
isIos,
isSSR
};

@@ -22,5 +24,6 @@ };

useEffect(() => {}, []);
return getMobileDetect(navigator.userAgent);
const userAgent = typeof navigator === 'undefined' ? 'SSR' : navigator.userAgent;
return getMobileDetect(userAgent);
};
module.exports = useMobileDetect;
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