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

universal-env

Package Overview
Dependencies
Maintainers
4
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 0.6.6 to 1.0.0

.eslintignore

37

dist/env.factory.js

@@ -0,3 +1,4 @@

// {"framework" : "Rax"}
module.exports = function(require, exports, module) {
with(this) { module.exports = /******/ (function(modules) { // webpackBootstrap
with(this) { module.exports = define("env.factory", function(require) {/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache

@@ -81,3 +82,3 @@ /******/ var installedModules = {};

/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ __webpack_require__.p = "/";
/******/

@@ -91,29 +92,19 @@ /******/

/* 0 */
/***/ (function(module, exports, __webpack_require__) {
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.isReactNative = exports.isWeex = exports.isNode = exports.isWeb = void 0;
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
// https://www.w3.org/TR/html5/webappapis.html#dom-navigator-appcodename
var isWeb = (typeof navigator === "undefined" ? "undefined" : _typeof(navigator)) === 'object' && (navigator.appCodeName === 'Mozilla' || navigator.product === 'Gecko');
exports.isWeb = isWeb;
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isWeb", function() { return isWeb; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isNode", function() { return isNode; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isWeex", function() { return isWeex; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isReactNative", function() { return isReactNative; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isMiniApp", function() { return isMiniApp; });
var isWeb = typeof navigator === 'object' && (navigator.appCodeName === 'Mozilla' || navigator.product === 'Gecko');
var isNode = typeof process !== 'undefined' && !!(process.versions && process.versions.node);
exports.isNode = isNode;
var isWeex = typeof callNative === 'function' || (typeof WXEnvironment === "undefined" ? "undefined" : _typeof(WXEnvironment)) === 'object' && WXEnvironment.platform !== 'Web';
exports.isWeex = isWeex;
var isWeex = typeof callNative === 'function' || typeof WXEnvironment === 'object' && WXEnvironment.platform !== 'Web';
var isReactNative = typeof __fbBatchedBridgeConfig !== 'undefined';
exports.isReactNative = isReactNative;
exports["default"] = module.exports;
var _default = module.exports;
exports.default = _default;
var isMiniApp = typeof my === 'object';
/***/ })
/******/ ])}};;
/******/ ])}); require("env.factory");}};;
//# sourceMappingURL=env.factory.map

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

// {"framework" : "Rax"}

@@ -24,3 +25,3 @@ ;(function(fn) {

})(function(){
return /******/ (function(modules) { // webpackBootstrap
return define("env", function(require) {/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache

@@ -104,3 +105,3 @@ /******/ var installedModules = {};

/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ __webpack_require__.p = "/";
/******/

@@ -114,29 +115,19 @@ /******/

/* 0 */
/***/ (function(module, exports, __webpack_require__) {
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.isReactNative = exports.isWeex = exports.isNode = exports.isWeb = void 0;
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
// https://www.w3.org/TR/html5/webappapis.html#dom-navigator-appcodename
var isWeb = (typeof navigator === "undefined" ? "undefined" : _typeof(navigator)) === 'object' && (navigator.appCodeName === 'Mozilla' || navigator.product === 'Gecko');
exports.isWeb = isWeb;
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isWeb", function() { return isWeb; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isNode", function() { return isNode; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isWeex", function() { return isWeex; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isReactNative", function() { return isReactNative; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isMiniApp", function() { return isMiniApp; });
var isWeb = typeof navigator === 'object' && (navigator.appCodeName === 'Mozilla' || navigator.product === 'Gecko');
var isNode = typeof process !== 'undefined' && !!(process.versions && process.versions.node);
exports.isNode = isNode;
var isWeex = typeof callNative === 'function' || (typeof WXEnvironment === "undefined" ? "undefined" : _typeof(WXEnvironment)) === 'object' && WXEnvironment.platform !== 'Web';
exports.isWeex = isWeex;
var isWeex = typeof callNative === 'function' || typeof WXEnvironment === 'object' && WXEnvironment.platform !== 'Web';
var isReactNative = typeof __fbBatchedBridgeConfig !== 'undefined';
exports.isReactNative = isReactNative;
exports["default"] = module.exports;
var _default = module.exports;
exports.default = _default;
var isMiniApp = typeof my === 'object';
/***/ })
/******/ ])});;
/******/ ])}); require("env");});;
//# sourceMappingURL=env.map

@@ -1,2 +0,3 @@

!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define)define("universal-env",function(n,t,o){o.exports=e()});else{("undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:this).UniversalEnv=e()}}(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){"use strict";function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.isReactNative=n.isWeex=n.isNode=n.isWeb=void 0;var r="object"===("undefined"==typeof navigator?"undefined":o(navigator))&&("Mozilla"===navigator.appCodeName||"Gecko"===navigator.product);n.isWeb=r;var i="undefined"!=typeof process&&!(!process.versions||!process.versions.node);n.isNode=i;var f="function"==typeof callNative||"object"===("undefined"==typeof WXEnvironment?"undefined":o(WXEnvironment))&&"Web"!==WXEnvironment.platform;n.isWeex=f;var u="undefined"!=typeof __fbBatchedBridgeConfig;n.isReactNative=u,n.default=e.exports;var d=e.exports;n.default=d}])});
// {"framework" : "Rax"}
!function(o){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=o();else if("function"==typeof define)define("universal-env",function(e,n,t){t.exports=o()});else{("undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:this).UniversalEnv=o()}}(function(){return define("env.min",function(e){function r(e){if(o[e])return o[e].exports;var n=o[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,r),n.l=!0,n.exports}var t,o;o={},r.m=t=[function(e,n,t){"use strict";t.r(n),t.d(n,"isWeb",function(){return o}),t.d(n,"isNode",function(){return r}),t.d(n,"isWeex",function(){return i}),t.d(n,"isReactNative",function(){return f}),t.d(n,"isMiniApp",function(){return u});var o="object"==typeof navigator&&("Mozilla"===navigator.appCodeName||"Gecko"===navigator.product),r="undefined"!=typeof process&&!(!process.versions||!process.versions.node),i="function"==typeof callNative||"object"==typeof WXEnvironment&&"Web"!==WXEnvironment.platform,f="undefined"!=typeof __fbBatchedBridgeConfig,u="object"==typeof my}],r.c=o,r.d=function(e,n,t){r.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:t})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(n,e){if(1&e&&(n=r(n)),8&e)return n;if(4&e&&"object"==typeof n&&n&&n.__esModule)return n;var t=Object.create(null);if(r.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:n}),2&e&&"string"!=typeof n)for(var o in n)r.d(t,o,function(e){return n[e]}.bind(null,o));return t},r.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(n,"a",n),n},r.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},r.p="/",r(r.s=0)})});
//# sourceMappingURL=env.min.map

@@ -1,12 +0,5 @@

/**
* universal env
* 环境变量
*/
export const isWeb: boolean;
export const isNode: boolean;
export const isWeex: boolean;
export const isReactNative: boolean;
export declare const isWeb: boolean;
export declare const isNode: boolean;
export declare const isWeex: boolean;
export declare const isReactNative: boolean;
export declare const isMiniApp: boolean;
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.isReactNative = exports.isWeex = exports.isNode = exports.isWeb = void 0;
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
// https://www.w3.org/TR/html5/webappapis.html#dom-navigator-appcodename
var isWeb = (typeof navigator === "undefined" ? "undefined" : _typeof(navigator)) === 'object' && (navigator.appCodeName === 'Mozilla' || navigator.product === 'Gecko');
exports.__esModule = true;
exports.isMiniApp = exports.isReactNative = exports.isWeex = exports.isNode = exports.isWeb = void 0;
var isWeb = typeof navigator === 'object' && (navigator.appCodeName === 'Mozilla' || navigator.product === 'Gecko');
exports.isWeb = isWeb;
var isNode = typeof process !== 'undefined' && !!(process.versions && process.versions.node);
exports.isNode = isNode;
var isWeex = typeof callNative === 'function' || (typeof WXEnvironment === "undefined" ? "undefined" : _typeof(WXEnvironment)) === 'object' && WXEnvironment.platform !== 'Web';
var isWeex = typeof callNative === 'function' || typeof WXEnvironment === 'object' && WXEnvironment.platform !== 'Web';
exports.isWeex = isWeex;
var isReactNative = typeof __fbBatchedBridgeConfig !== 'undefined';
exports.isReactNative = isReactNative;
exports["default"] = module.exports;
var _default = module.exports;
exports.default = _default;
var isMiniApp = typeof my === 'object';
exports.isMiniApp = isMiniApp;
{
"name": "universal-env",
"version": "0.6.6",
"description": "A universal environment utilities.",
"license": "BSD-3-Clause",
"author": "rax",
"version": "1.0.0",
"main": "lib/index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/alibaba/rax.git"
"types": "lib/index.d.ts",
"miniappConfig": {
"main": "lib/index.js"
},
"bugs": {
"url": "https://github.com/alibaba/rax/issues"
"scripts": {
"start": "rax-scripts start --type 'component' -p 8000",
"start:miniapp": "rax-scripts start --type 'component-miniapp'",
"build": "rax-scripts build --type 'component'",
"test": "rax-scripts test",
"lint": "eslint --ext .js --ext .jsx --ext .ts --ext .tsx ./src",
"prebuild": "npm run lint && yarn run test",
"prepublish": "npm run build"
},
"homepage": "https://github.com/alibaba/rax#readme"
"keywords": [
"Rax"
],
"engines": {
"npm": ">=3.0.0"
},
"dependencies": {},
"devDependencies": {
"@types/jest": "^24.0.13",
"@typescript-eslint/eslint-plugin": "^1.7.0",
"@typescript-eslint/parser": "^1.7.0",
"babel-eslint": "^10.0.1",
"driver-dom": "^1.0.0",
"eslint": "^5.15.1",
"eslint-config-rax": "^0.0.0",
"eslint-plugin-import": "^2.17.2",
"eslint-plugin-react": "^7.12.4",
"rax": "^1.0.4",
"rax-scripts": "1.2.1-beta.2",
"typescript": "^3.4.5"
}
}

@@ -1,7 +0,6 @@

# universal-env [![npm](https://img.shields.io/npm/v/universal-env.svg)](https://www.npmjs.com/package/universal-env)
# universal-env
> Judge runtime environment
Judge runtime environment
## Install
```bash

@@ -12,5 +11,21 @@ $ npm install universal-env --save

## Usage
```javascript
import { isWeex, isWeb, isMiniApp, isReactNative, isNode } from 'universal-env';
```js
import {isWeex, isWeb, isReactNative, isNode} from 'universal-env';
```
```
## APIS
### `isWeex: boolean`
Checks if environment is a weex environment.
### `isWeb: boolean`
Checks if environment is a web environment.
### `isMiniApp: boolean`
Checks if environment is a mini app environment.
### `isReactNative: boolean`
Checks if environment is a React Native environment.
### `isNode: boolean`
Checks if environment is a Node.js environment.

Sorry, the diff of this file is not supported yet

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