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

universal-env

Package Overview
Dependencies
Maintainers
6
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 3.2.3-1 to 3.3.0-0

CHANGELOG.md

2

dist/index-es6.js

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

!function(e){var n={};function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:o})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(t.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var r in e)t.d(o,r,function(n){return e[n]}.bind(null,r));return o},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="./",t(t.s=0)}([function(e,n,t){e.exports=t(1)},function(e,n,t){"use strict";function o(e){return"undefined"===e}t.r(n),t.d(n,"isWeb",(function(){return r})),t.d(n,"isNode",(function(){return i})),t.d(n,"isWeex",(function(){return u})),t.d(n,"isWeex2",(function(){return f})),t.d(n,"isKraken",(function(){return c})),t.d(n,"isMiniApp",(function(){return l})),t.d(n,"isByteDanceMicroApp",(function(){return p})),t.d(n,"isWeChatMiniProgram",(function(){return s})),t.d(n,"isQuickApp",(function(){return a}));const r=!o(typeof window)&&"onload"in window,i=!o(typeof process)&&!(!process.versions||!process.versions.node),u=!o(typeof WXEnvironment)&&"Web"!==WXEnvironment.platform,f=u&&!o(typeof weex)&&weex.config&&"2.0"===weex.config.weexMode,c=!o(typeof __kraken__),l=!o(typeof my)&&null!==my&&!o(typeof my.alert),p=!o(typeof tt)&&null!==tt&&!o(typeof tt)&&!o(tt.showToast),s=!(p||o(typeof wx)||null===wx||o(typeof wx.login)&&o(typeof wx.miniProgram)),a=!o(typeof global)&&null!==global&&!o(typeof global.callNative)&&!u}]);
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="./",n(n.s=1)}([function(e,t){e.exports=require("@uni/env")},function(e,t,n){e.exports=n(2)},function(e,t,n){"use strict";n.r(t);var r=n(0);for(var o in r)["default"].indexOf(o)<0&&function(e){n.d(t,e,(function(){return r[e]}))}(o)}]);

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

!function(e){var n={};function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:o})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(t.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var r in e)t.d(o,r,function(n){return e[n]}.bind(null,r));return o},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="./",t(t.s=0)}([function(e,n,t){e.exports=t(1)},function(e,n,t){"use strict";function o(e){return"undefined"===e}t.r(n),t.d(n,"isWeb",(function(){return r})),t.d(n,"isNode",(function(){return i})),t.d(n,"isWeex",(function(){return u})),t.d(n,"isWeex2",(function(){return f})),t.d(n,"isKraken",(function(){return l})),t.d(n,"isMiniApp",(function(){return c})),t.d(n,"isByteDanceMicroApp",(function(){return p})),t.d(n,"isWeChatMiniProgram",(function(){return a})),t.d(n,"isQuickApp",(function(){return s}));var r=!o(typeof window)&&"onload"in window,i=!o(typeof process)&&!(!process.versions||!process.versions.node),u=!o(typeof WXEnvironment)&&"Web"!==WXEnvironment.platform,f=u&&!o(typeof weex)&&weex.config&&"2.0"===weex.config.weexMode,l=!o(typeof __kraken__),c=!o(typeof my)&&null!==my&&!o(typeof my.alert),p=!o(typeof tt)&&null!==tt&&!o(typeof tt)&&!o(tt.showToast),a=!(p||o(typeof wx)||null===wx||o(typeof wx.login)&&o(typeof wx.miniProgram)),s=!o(typeof global)&&null!==global&&!o(typeof global.callNative)&&!u}]);
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="./",n(n.s=1)}([function(e,t){e.exports=require("@uni/env")},function(e,t,n){e.exports=n(2)},function(e,t,n){"use strict";n.r(t);var r=n(0);for(var o in r)["default"].indexOf(o)<0&&function(e){n.d(t,e,(function(){return r[e]}))}(o)}]);

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

!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.universalEnv=n():e.universalEnv=n()}(window,(function(){return function(e){var n={};function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}return t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:o})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(t.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var r in e)t.d(o,r,function(n){return e[n]}.bind(null,r));return o},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="./",t(t.s=0)}([function(e,n,t){e.exports=t(1)},function(e,n,t){"use strict";function o(e){return"undefined"===e}t.r(n),t.d(n,"isWeb",(function(){return r})),t.d(n,"isNode",(function(){return i})),t.d(n,"isWeex",(function(){return u})),t.d(n,"isWeex2",(function(){return f})),t.d(n,"isKraken",(function(){return c})),t.d(n,"isMiniApp",(function(){return p})),t.d(n,"isByteDanceMicroApp",(function(){return l})),t.d(n,"isWeChatMiniProgram",(function(){return s})),t.d(n,"isQuickApp",(function(){return d}));var r=!o(typeof window)&&"onload"in window,i=!o(typeof process)&&!(!process.versions||!process.versions.node),u=!o(typeof WXEnvironment)&&"Web"!==WXEnvironment.platform,f=u&&!o(typeof weex)&&weex.config&&"2.0"===weex.config.weexMode,c=!o(typeof __kraken__),p=!o(typeof my)&&null!==my&&!o(typeof my.alert),l=!o(typeof tt)&&null!==tt&&!o(typeof tt)&&!o(tt.showToast),s=!(l||o(typeof wx)||null===wx||o(typeof wx.login)&&o(typeof wx.miniProgram)),d=!o(typeof global)&&null!==global&&!o(typeof global.callNative)&&!u}])}));
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.universalEnv=t():e.universalEnv=t()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="./",n(n.s=1)}([function(e,t){e.exports=require("@uni/env")},function(e,t,n){e.exports=n(2)},function(e,t,n){"use strict";n.r(t);var r=n(0);for(var o in r)["default"].indexOf(o)<0&&function(e){n.d(t,e,(function(){return r[e]}))}(o)}])}));

@@ -1,9 +0,1 @@

export declare const isWeb: boolean;
export declare const isNode: boolean;
export declare const isWeex: boolean;
export declare const isWeex2: boolean;
export declare const isKraken: boolean;
export declare const isMiniApp: boolean;
export declare const isByteDanceMicroApp: boolean;
export declare const isWeChatMiniProgram: boolean;
export declare const isQuickApp: boolean;
export * from '@uni/env';
"use strict";
exports.__esModule = true;
exports.isQuickApp = exports.isWeChatMiniProgram = exports.isByteDanceMicroApp = exports.isMiniApp = exports.isKraken = exports.isWeex2 = exports.isWeex = exports.isNode = exports.isWeb = void 0;
function isUndef(type) {
return type === 'undefined';
}
var _env = require("@uni/env");
var isWeb = !isUndef(typeof window) && 'onload' in window;
exports.isWeb = isWeb;
var isNode = !isUndef(typeof process) && !!(process.versions && process.versions.node);
exports.isNode = isNode;
var isWeex = !isUndef(typeof WXEnvironment) && WXEnvironment.platform !== 'Web';
exports.isWeex = isWeex;
var isWeex2 = isWeex && !isUndef(typeof weex) && weex.config && weex.config.weexMode === '2.0';
exports.isWeex2 = isWeex2;
var isKraken = !isUndef(typeof __kraken__);
exports.isKraken = isKraken;
var isMiniApp = !isUndef(typeof my) && my !== null && !isUndef(typeof my.alert);
exports.isMiniApp = isMiniApp;
var isByteDanceMicroApp = !isUndef(typeof tt) && tt !== null && !isUndef(typeof tt) && !isUndef(tt.showToast); // In wechat mini program, wx.login is a function
// In wechat mini propgram webview, there is no wx.login, but exist wx.miniProgram
// In bytedance maicro app, there is wx variable.
exports.isByteDanceMicroApp = isByteDanceMicroApp;
var isWeChatMiniProgram = !isByteDanceMicroApp && !isUndef(typeof wx) && wx !== null && (!isUndef(typeof wx.login) || !isUndef(typeof wx.miniProgram));
exports.isWeChatMiniProgram = isWeChatMiniProgram;
var isQuickApp = !isUndef(typeof global) && global !== null && !isUndef(typeof global.callNative) && !isWeex;
exports.isQuickApp = isQuickApp;
Object.keys(_env).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (key in exports && exports[key] === _env[key]) return;
exports[key] = _env[key];
});
{
"name": "universal-env",
"author": "rax",
"version": "3.2.3-1",
"version": "3.3.0-0",
"description": "",

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

"typescript": "^3.7.5"
},
"dependencies": {
"@uni/env": "^1.0.0"
}
}

@@ -6,3 +6,3 @@ # universal-env [![npm](https://img.shields.io/npm/v/universal-env.svg)](https://www.npmjs.com/package/universal-env)

## 支持
<img alt="browser" src="https://gw.alicdn.com/tfs/TB1uYFobGSs3KVjSZPiXXcsiVXa-200-200.svg" width="25px" height="25px" /> <img alt="weex" src="https://gw.alicdn.com/tfs/TB1jM0ebMaH3KVjSZFjXXcFWpXa-200-200.svg" width="25px" height="25px" /> <img alt="miniApp" src="https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg" width="25px" height="25px" /> <img alt="wechatMiniprogram" src="https://img.alicdn.com/tfs/TB1slcYdxv1gK0jSZFFXXb0sXXa-200-200.svg" width="25px" height="25px"> <img alt="bytedanceMicroApp" src="https://gw.alicdn.com/tfs/TB1jFtVzO_1gK0jSZFqXXcpaXXa-200-200.svg" width="25px" height="25px"> <img alt="quickApp" src="https://gw.alicdn.com/tfs/TB1MP7EwQT2gK0jSZPcXXcKkpXa-200-200.svg" width="25px" height="25px">
<img alt="browser" src="https://gw.alicdn.com/tfs/TB1uYFobGSs3KVjSZPiXXcsiVXa-200-200.svg" width="25px" height="25px" /> <img alt="weex" src="https://gw.alicdn.com/tfs/TB1jM0ebMaH3KVjSZFjXXcFWpXa-200-200.svg" width="25px" height="25px" /> <img alt="miniApp" src="https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg" width="25px" height="25px" /> <img alt="wechatMiniprogram" src="https://img.alicdn.com/tfs/TB1slcYdxv1gK0jSZFFXXb0sXXa-200-200.svg" width="25px" height="25px"> <img alt="bytedanceMicroApp" src="https://gw.alicdn.com/tfs/TB1jFtVzO_1gK0jSZFqXXcpaXXa-200-200.svg" width="25px" height="25px"> <img alt="quickApp" src="https://gw.alicdn.com/tfs/TB1MP7EwQT2gK0jSZPcXXcKkpXa-200-200.svg" width="25px" height="25px"> <img alt="baiduSmartProgram" src="https://img.alicdn.com/imgextra/i4/O1CN01jngdBb24yGv2Fu34G_!!6000000007459-2-tps-200-200.png" width="25px" height="25px" title="百度小程序"> <img alt="kuaiShouMiniProgram" src="https://gw.alicdn.com/imgextra/i4/O1CN01kzmJMM24jcFEzp5Wv_!!6000000007427-2-tps-200-200.png" width="25px" height="25px" title="快手小程序">

@@ -16,3 +16,3 @@ ## 安装

```javascript
import { isWeex, isWeb, isMiniApp, isNode, isWeChatMiniProgram, isByteDanceMicroApp, isQuickApp } from 'universal-env';
import { isWeex, isWeb, isMiniApp, isNode, isWeChatMiniProgram, isByteDanceMicroApp, isQuickApp, isBaiduSmartProgram, isKuaiShouMiniProgram } from 'universal-env';

@@ -37,2 +37,8 @@ ```

### `isBaiduSmartProgram: boolean`
校验百度小程序环境
### `isKuaiShouMiniProgram: boolean`
校验快手小程序环境
### `isQuickApp: boolean`

@@ -39,0 +45,0 @@ 校验快应用环境

@@ -1,24 +0,1 @@

declare const WXEnvironment: any;
declare const __kraken__: any;
declare const my: any;
declare const wx: any;
declare const tt: any;
declare const global: any;
declare const weex: any;
function isUndef(type): boolean {
return type === 'undefined';
}
export const isWeb = !isUndef(typeof window) && 'onload' in window;
export const isNode = !isUndef(typeof process) && !!(process.versions && process.versions.node);
export const isWeex = !isUndef(typeof WXEnvironment) && WXEnvironment.platform !== 'Web';
export const isWeex2 = isWeex && !isUndef(typeof weex) && weex.config && weex.config.weexMode === '2.0';
export const isKraken = !isUndef(typeof __kraken__);
export const isMiniApp = !isUndef(typeof my) && my !== null && !isUndef(typeof my.alert);
export const isByteDanceMicroApp = !isUndef(typeof tt) && tt !== null && !isUndef(typeof tt) && !isUndef(tt.showToast);
// In wechat mini program, wx.login is a function
// In wechat mini propgram webview, there is no wx.login, but exist wx.miniProgram
// In bytedance maicro app, there is wx variable.
export const isWeChatMiniProgram = !isByteDanceMicroApp && !isUndef(typeof wx) && wx !== null && (!isUndef(typeof wx.login) || !isUndef(typeof wx.miniProgram));
export const isQuickApp = !isUndef(typeof global) && global !== null && !isUndef(typeof global.callNative) && !isWeex;
export * from '@uni/env';
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