Socket
Socket
Sign inDemoInstall

@datadog/browser-core

Package Overview
Dependencies
Maintainers
1
Versions
256
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@datadog/browser-core - npm Package Compare versions

Comparing version 1.9.2 to 1.9.3

3

cjs/utils.d.ts

@@ -82,2 +82,5 @@ export declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;

export declare function isEmptyObject(object: object): boolean;
/**
* inspired by https://mathiasbynens.be/notes/globalthis
*/
export declare function getGlobalObject<T>(): T;

@@ -84,0 +87,0 @@ export declare function getLocationOrigin(): string;

@@ -227,5 +227,33 @@ "use strict";

exports.isEmptyObject = isEmptyObject;
/**
* inspired by https://mathiasbynens.be/notes/globalthis
*/
function getGlobalObject() {
// tslint:disable-next-line: function-constructor no-function-constructor-with-string-args
return (typeof globalThis === 'object' ? globalThis : Function('return this')());
if (typeof globalThis === 'object') {
return globalThis;
}
Object.defineProperty(Object.prototype, '_dd_temp_', {
get: function () {
return this;
},
configurable: true,
});
// @ts-ignore
var globalObject = _dd_temp_;
// @ts-ignore
delete Object.prototype._dd_temp_;
if (typeof globalObject !== 'object') {
// on safari _dd_temp_ is available on window but not globally
// fallback on other browser globals check
if (typeof self === 'object') {
globalObject = self;
}
else if (typeof window === 'object') {
globalObject = window;
}
else {
globalObject = {};
}
}
return globalObject;
}

@@ -232,0 +260,0 @@ exports.getGlobalObject = getGlobalObject;

@@ -82,2 +82,5 @@ export declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;

export declare function isEmptyObject(object: object): boolean;
/**
* inspired by https://mathiasbynens.be/notes/globalthis
*/
export declare function getGlobalObject<T>(): T;

@@ -84,0 +87,0 @@ export declare function getLocationOrigin(): string;

@@ -205,5 +205,33 @@ export var ONE_SECOND = 1000;

}
/**
* inspired by https://mathiasbynens.be/notes/globalthis
*/
export function getGlobalObject() {
// tslint:disable-next-line: function-constructor no-function-constructor-with-string-args
return (typeof globalThis === 'object' ? globalThis : Function('return this')());
if (typeof globalThis === 'object') {
return globalThis;
}
Object.defineProperty(Object.prototype, '_dd_temp_', {
get: function () {
return this;
},
configurable: true,
});
// @ts-ignore
var globalObject = _dd_temp_;
// @ts-ignore
delete Object.prototype._dd_temp_;
if (typeof globalObject !== 'object') {
// on safari _dd_temp_ is available on window but not globally
// fallback on other browser globals check
if (typeof self === 'object') {
globalObject = self;
}
else if (typeof window === 'object') {
globalObject = window;
}
else {
globalObject = {};
}
}
return globalObject;
}

@@ -210,0 +238,0 @@ export function getLocationOrigin() {

4

package.json
{
"name": "@datadog/browser-core",
"version": "1.9.2",
"version": "1.9.3",
"license": "Apache-2.0",

@@ -29,3 +29,3 @@ "main": "cjs/index.js",

},
"gitHead": "0cd09ed4844930c19084b9ac9c24635e108678ee"
"gitHead": "bc358020a4d7e933f4c71c7e00d48cb66a7ab2fb"
}

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