Socket
Socket
Sign inDemoInstall

universal-env

Package Overview
Dependencies
Maintainers
5
Versions
117
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

universal-env - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

9

lib/index.js

@@ -5,2 +5,4 @@ "use strict";

exports.isIOS = exports.isAndroid = exports.isWeb = exports.isWechatApp = exports.isMiniApp = exports.isReactNative = exports.isWeex = exports.isNode = void 0;
// compatibility taobao mp
var isTaoWebview = typeof __sfc__ !== 'undefined';
var isWebPure = typeof navigator === 'object' && (navigator.appCodeName === 'Mozilla' || navigator.product === 'Gecko');

@@ -11,9 +13,10 @@ var isNode = typeof process !== 'undefined' && !!(process.versions && process.versions.node);

exports.isWeex = isWeex;
var isReactNative = typeof __fbBatchedBridgeConfig !== 'undefined';
var isReactNative = typeof __fbBatchedBridgeConfig !== 'undefined'; // In taobao mp'webview __sfc__ is an object
exports.isReactNative = isReactNative;
var isMiniApp = typeof my === 'object' && typeof my.getSystemInfo !== 'undefined';
var isMiniApp = typeof my === 'object' && typeof my.getSystemInfo !== 'undefined' || isTaoWebview;
exports.isMiniApp = isMiniApp;
var isWechatApp = typeof wx === 'object' && typeof wx.getSystemInfo !== 'undefined';
exports.isWechatApp = isWechatApp;
var isWeb = isWebPure && !isMiniApp && !isWechatApp;
var isWeb = isWebPure && !isMiniApp && !isWechatApp || isTaoWebview;
exports.isWeb = isWeb;

@@ -20,0 +23,0 @@ var systemInfo = {};

{
"name": "universal-env",
"author": "rax",
"version": "1.0.4",
"version": "1.0.5",
"license": "BSD-3-Clause",

@@ -6,0 +6,0 @@ "main": "lib/index.js",

@@ -7,3 +7,4 @@ // https://www.w3.org/TR/html5/webappapis.html#dom-navigator-appcodename

declare const wx: any;
// compatibility taobao mp
const isTaoWebview = typeof __sfc__ !== 'undefined';
const isWebPure: boolean = typeof navigator === 'object' && (navigator.appCodeName === 'Mozilla' || navigator.product === 'Gecko');

@@ -13,6 +14,8 @@ export const isNode: boolean = typeof process !== 'undefined' && !!(process.versions && process.versions.node);

export const isReactNative: boolean = typeof __fbBatchedBridgeConfig !== 'undefined';
export const isMiniApp: boolean = typeof my === 'object' && typeof my.getSystemInfo !== 'undefined';
// In taobao mp'webview __sfc__ is an object
export const isMiniApp: boolean = typeof my === 'object' && typeof my.getSystemInfo !== 'undefined' || isTaoWebview;
export const isWechatApp: boolean = typeof wx === 'object' && typeof wx.getSystemInfo !== 'undefined';
export const isWeb: boolean = isWebPure && !isMiniApp && !isWechatApp;
export const isWeb: boolean = isWebPure && !isMiniApp && !isWechatApp || isTaoWebview;
let systemInfo: any = {};

@@ -19,0 +22,0 @@ if (isMiniApp) {

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