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

@probe.gl/env

Package Overview
Dependencies
Maintainers
3
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@probe.gl/env - npm Package Compare versions

Comparing version 4.0.6 to 4.0.7

12

dist/index.d.ts

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

export { VERSION } from './utils/globals';
export { self, window, global, document, process, console } from './lib/globals';
export { default as isBrowser, isBrowserMainThread } from './lib/is-browser';
export { default as getBrowser, isMobile } from './lib/get-browser';
export { default as isElectron } from './lib/is-electron';
export { default as assert } from './utils/assert';
export { VERSION } from "./utils/globals.js";
export { self, window, global, document, process, console } from "./lib/globals.js";
export { default as isBrowser, isBrowserMainThread } from "./lib/is-browser.js";
export { default as getBrowser, isMobile } from "./lib/get-browser.js";
export { default as isElectron } from "./lib/is-electron.js";
export { default as assert } from "./utils/assert.js";
//# sourceMappingURL=index.d.ts.map
export { VERSION } from "./utils/globals.js";
// ENVIRONMENT
export { self, window, global, document, process, console } from "./lib/globals.js";

@@ -6,3 +7,3 @@ export { default as isBrowser, isBrowserMainThread } from "./lib/is-browser.js";

export { default as isElectron } from "./lib/is-electron.js";
// ENVIRONMENT'S ASSERT IS 5-15KB, SO WE PROVIDE OUR OWN
export { default as assert } from "./utils/assert.js";
//# sourceMappingURL=index.js.map

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

// Copyright (c) 2017 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
// This function is needed in initialization stages,
// make sure it can be imported in isolation
import isBrowser from "./is-browser.js";

@@ -6,40 +27,35 @@ import isElectron from "./is-electron.js";

export function isMobile() {
return typeof window.orientation !== 'undefined';
return typeof window.orientation !== 'undefined';
}
// Simple browser detection
// `mockUserAgent` parameter allows user agent to be overridden for testing
/* eslint-disable complexity */
export default function getBrowser(mockUserAgent) {
if (!mockUserAgent && !isBrowser()) {
return 'Node';
}
if (isElectron(mockUserAgent)) {
return 'Electron';
}
const userAgent = mockUserAgent || navigator.userAgent || '';
if (userAgent.indexOf('Edge') > -1) {
return 'Edge';
}
const isMSIE = userAgent.indexOf('MSIE ') !== -1;
const isTrident = userAgent.indexOf('Trident/') !== -1;
if (isMSIE || isTrident) {
return 'IE';
}
if (window.chrome) {
return 'Chrome';
}
if (window.safari) {
return 'Safari';
}
if (window.mozInnerScreenX) {
return 'Firefox';
}
return 'Unknown';
if (!mockUserAgent && !isBrowser()) {
return 'Node';
}
if (isElectron(mockUserAgent)) {
return 'Electron';
}
const userAgent = mockUserAgent || navigator.userAgent || '';
// const appVersion = navigator_.appVersion || '';
// NOTE: Order of tests matter, as many agents list Chrome etc.
if (userAgent.indexOf('Edge') > -1) {
return 'Edge';
}
const isMSIE = userAgent.indexOf('MSIE ') !== -1;
const isTrident = userAgent.indexOf('Trident/') !== -1;
if (isMSIE || isTrident) {
return 'IE';
}
if (window.chrome) {
return 'Chrome';
}
if (window.safari) {
return 'Safari';
}
if (window.mozInnerScreenX) {
return 'Firefox';
}
return 'Unknown';
}
//# sourceMappingURL=get-browser.js.map

@@ -0,4 +1,6 @@

// Do not name these variables the same as the global objects - will break bundling
const global_ = globalThis;
// eslint-disable-next-line consistent-this
const self_ = globalThis.self || globalThis.window || globalThis.global;
const window_ = globalThis.window || globalThis.self || globalThis.global;
const window_ = (globalThis.window || globalThis.self || globalThis.global);
const document_ = globalThis.document || {};

@@ -9,2 +11,1 @@ const process_ = globalThis.process || {};

export { global_ as global, self_ as self, window_ as window, document_ as document, process_ as process, console_ as console, navigator_ as navigator };
//# sourceMappingURL=globals.js.map

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

// This function is needed in initialization stages,
// make sure it can be imported in isolation
import isElectron from "./is-electron.js";
export default function isBrowser() {
const isNode = typeof process === 'object' && String(process) === '[object process]' && !process.browser;
return !isNode || isElectron();
// Check if in browser by duck-typing Node context
const isNode =
// @ts-expect-error
typeof process === 'object' && String(process) === '[object process]' && !process.browser;
return !isNode || isElectron();
}
// document does not exist on worker thread
export function isBrowserMainThread() {
return isBrowser() && typeof document !== 'undefined';
return isBrowser() && typeof document !== 'undefined';
}
//# sourceMappingURL=is-browser.js.map

@@ -0,19 +1,26 @@

// based on https://github.com/cheton/is-electron
// https://github.com/electron/electron/issues/2288
/* eslint-disable complexity */
export default function isElectron(mockUserAgent) {
if (typeof window !== 'undefined' && typeof window.process === 'object' && window.process.type === 'renderer') {
return true;
}
if (typeof process !== 'undefined' && typeof process.versions === 'object' && Boolean(process.versions['electron'])) {
return true;
}
const realUserAgent = typeof navigator === 'object' && typeof navigator.userAgent === 'string' && navigator.userAgent;
const userAgent = mockUserAgent || realUserAgent;
if (userAgent && userAgent.indexOf('Electron') >= 0) {
return true;
}
return false;
// Renderer process
if (typeof window !== 'undefined' &&
typeof window.process === 'object' &&
// @ts-expect-error
window.process.type === 'renderer') {
return true;
}
// Main process
if (typeof process !== 'undefined' &&
typeof process.versions === 'object' &&
// eslint-disable-next-line
Boolean(process.versions['electron'])) {
return true;
}
// Detect the user agent when the `nodeIntegration` option is set to true
const realUserAgent = typeof navigator === 'object' && typeof navigator.userAgent === 'string' && navigator.userAgent;
const userAgent = mockUserAgent || realUserAgent;
if (userAgent && userAgent.indexOf('Electron') >= 0) {
return true;
}
return false;
}
//# sourceMappingURL=is-electron.js.map
export default function assert(condition, message) {
if (!condition) {
throw new Error(message || 'Assertion failed');
}
if (!condition) {
throw new Error(message || 'Assertion failed');
}
}
//# sourceMappingURL=assert.js.map

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

export { self, window, global, document, process, console } from '../lib/globals';
export { self, window, global, document, process, console } from "../lib/globals.js";
export declare const VERSION: any;
export declare const isBrowser: boolean;
//# sourceMappingURL=globals.d.ts.map
import checkIfBrowser from "../lib/is-browser.js";
export { self, window, global, document, process, console } from "../lib/globals.js";
export const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'untranspiled source';
// Extract injected version from package.json (injected by babel plugin)
// @ts-expect-error
export const VERSION = typeof "4.0.6" !== 'undefined' ? "4.0.6" : 'untranspiled source';
export const isBrowser = checkIfBrowser();
//# sourceMappingURL=globals.js.map

@@ -6,3 +6,3 @@ {

"type": "module",
"version": "4.0.6",
"version": "4.0.7",
"keywords": [

@@ -36,6 +36,3 @@ "javascript",

],
"dependencies": {
"@babel/runtime": "^7.0.0"
},
"gitHead": "ed10fc803b4b0feb08bdcde39ef9407db1f79e64"
"gitHead": "e1192bb8b78fb8f713519ab693638408da08de16"
}

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

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