Socket
Socket
Sign inDemoInstall

@polkadot/x-global

Package Overview
Dependencies
Maintainers
2
Versions
629
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@polkadot/x-global - npm Package Compare versions

Comparing version 10.4.2 to 11.0.1

56

cjs/index.js
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.exposeGlobal = exposeGlobal;
exports.extractGlobal = extractGlobal;
Object.defineProperty(exports, "packageInfo", {
enumerable: true,
get: function () {
return _packageInfo.packageInfo;
}
});
exports.xglobal = void 0;
var _packageInfo = require("./packageInfo");
// Copyright 2017-2023 @polkadot/x-global authors & contributors
// SPDX-License-Identifier: Apache-2.0
Object.defineProperty(exports, "__esModule", { value: true });
exports.exposeGlobal = exports.extractGlobal = exports.xglobal = exports.packageInfo = void 0;
var packageInfo_1 = require("./packageInfo");
Object.defineProperty(exports, "packageInfo", { enumerable: true, get: function () { return packageInfo_1.packageInfo; } });
function evaluateThis(fn) {
return fn('return this');
return fn('return this');
}
const xglobal = typeof globalThis !== 'undefined' ? globalThis : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : evaluateThis(Function);
exports.xglobal = xglobal;
exports.xglobal = (typeof globalThis !== 'undefined'
? globalThis
: typeof global !== 'undefined'
? global
: typeof self !== 'undefined'
? self
: typeof window !== 'undefined'
? window
: evaluateThis(Function));
function extractGlobal(name, fallback) {
// Not quite sure why this is here - snuck in with TS 4.7.2 with no real idea
// (as of now) as to why this looks like an "any" when we do cast it to a T
//
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return typeof xglobal[name] === 'undefined' ? fallback : xglobal[name];
// Not quite sure why this is here - snuck in with TS 4.7.2 with no real idea
// (as of now) as to why this looks like an "any" when we do cast it to a T
//
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return typeof exports.xglobal[name] === 'undefined'
? fallback
: exports.xglobal[name];
}
exports.extractGlobal = extractGlobal;
function exposeGlobal(name, fallback) {
if (typeof xglobal[name] === 'undefined') {
xglobal[name] = fallback;
}
}
if (typeof exports.xglobal[name] === 'undefined') {
exports.xglobal[name] = fallback;
}
}
exports.exposeGlobal = exposeGlobal;
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "__esModule", { value: true });
exports.packageInfo = void 0;
// Copyright 2017-2023 @polkadot/x-global authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @polkadot/dev
const packageInfo = {
name: '@polkadot/x-global',
path: typeof __dirname === 'string' ? __dirname : 'auto',
type: 'cjs',
version: '10.4.2'
};
exports.packageInfo = packageInfo;
exports.packageInfo = { name: '@polkadot/x-global', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '11.0.1' };

@@ -1,25 +0,27 @@

// Copyright 2017-2023 @polkadot/x-global authors & contributors
// SPDX-License-Identifier: Apache-2.0
export { packageInfo } from "./packageInfo.js";
// Ensure that we are able to run this without any @types/node definitions
// and without having lib: ['dom'] in our TypeScript configuration
// (may not be available in all environments, e.g. Deno springs to mind)
export { packageInfo } from './packageInfo.js';
function evaluateThis(fn) {
return fn('return this');
return fn('return this');
}
export const xglobal = typeof globalThis !== 'undefined' ? globalThis : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : evaluateThis(Function);
export const xglobal = (typeof globalThis !== 'undefined'
? globalThis
: typeof global !== 'undefined'
? global
: typeof self !== 'undefined'
? self
: typeof window !== 'undefined'
? window
: evaluateThis(Function));
export function extractGlobal(name, fallback) {
// Not quite sure why this is here - snuck in with TS 4.7.2 with no real idea
// (as of now) as to why this looks like an "any" when we do cast it to a T
//
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return typeof xglobal[name] === 'undefined' ? fallback : xglobal[name];
// Not quite sure why this is here - snuck in with TS 4.7.2 with no real idea
// (as of now) as to why this looks like an "any" when we do cast it to a T
//
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return typeof xglobal[name] === 'undefined'
? fallback
: xglobal[name];
}
export function exposeGlobal(name, fallback) {
if (typeof xglobal[name] === 'undefined') {
xglobal[name] = fallback;
}
if (typeof xglobal[name] === 'undefined') {
xglobal[name] = fallback;
}
}

@@ -20,3 +20,3 @@ {

"type": "module",
"version": "10.4.2",
"version": "11.0.1",
"main": "./cjs/index.js",

@@ -33,3 +33,6 @@ "module": "./index.js",

},
"./package.json": "./package.json",
"./package.json": {
"require": "./cjs/package.json",
"default": "./package.json"
},
"./packageInfo.js": {

@@ -47,4 +50,4 @@ "types": "./packageInfo.d.ts",

"dependencies": {
"@babel/runtime": "^7.20.13"
"tslib": "^2.5.0"
}
}

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

// Copyright 2017-2023 @polkadot/x-global authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = {
name: '@polkadot/x-global',
path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto',
type: 'esm',
version: '10.4.2'
};
export const packageInfo = { name: '@polkadot/x-global', path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '11.0.1' };
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