Socket
Socket
Sign inDemoInstall

@sentry/utils

Package Overview
Dependencies
Maintainers
9
Versions
499
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sentry/utils - npm Package Compare versions

Comparing version 5.0.6 to 5.0.7

15

dist/misc.d.ts

@@ -28,3 +28,3 @@ /// <reference types="node" />

*/
export declare function getGlobalObject<T extends Window | NodeJS.Global = any>(): T & SentryGlobal;
export declare function getGlobalObject<T>(): T & SentryGlobal;
/**

@@ -37,15 +37,2 @@ * UUID4 generator

/**
* Given a child DOM element, returns a query-selector statement describing that
* and its ancestors
* e.g. [HTMLElement] => body > div > input#foo.btn[name=baz]
* @returns generated DOM path
*/
export declare function htmlTreeAsString(elem: Node): string;
/**
* Returns a simple, query-selector representation of a DOM element
* e.g. [HTMLElement] => input#foo.btn[name=baz]
* @returns generated DOM path
*/
export declare function htmlElementAsString(elem: HTMLElement): string;
/**
* Parses string form of URL into an object

@@ -52,0 +39,0 @@ * // borrowed from https://tools.ietf.org/html/rfc3986#appendix-B

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var is_1 = require("./is");
/**

@@ -29,3 +28,2 @@ * Requires a module which is protected _against bundler minification.

*/
// tslint:disable:strict-type-predicates
function getGlobalObject() {

@@ -79,71 +77,2 @@ return (isNodeEnv()

/**
* Given a child DOM element, returns a query-selector statement describing that
* and its ancestors
* e.g. [HTMLElement] => body > div > input#foo.btn[name=baz]
* @returns generated DOM path
*/
function htmlTreeAsString(elem) {
var currentElem = elem;
var MAX_TRAVERSE_HEIGHT = 5;
var MAX_OUTPUT_LEN = 80;
var out = [];
var height = 0;
var len = 0;
var separator = ' > ';
var sepLength = separator.length;
var nextStr;
while (currentElem && height++ < MAX_TRAVERSE_HEIGHT) {
nextStr = htmlElementAsString(currentElem);
// bail out if
// - nextStr is the 'html' element
// - the length of the string that would be created exceeds MAX_OUTPUT_LEN
// (ignore this limit if we are on the first iteration)
if (nextStr === 'html' || (height > 1 && len + out.length * sepLength + nextStr.length >= MAX_OUTPUT_LEN)) {
break;
}
out.push(nextStr);
len += nextStr.length;
currentElem = currentElem.parentNode;
}
return out.reverse().join(separator);
}
exports.htmlTreeAsString = htmlTreeAsString;
/**
* Returns a simple, query-selector representation of a DOM element
* e.g. [HTMLElement] => input#foo.btn[name=baz]
* @returns generated DOM path
*/
function htmlElementAsString(elem) {
var out = [];
var className;
var classes;
var key;
var attr;
var i;
if (!elem || !elem.tagName) {
return '';
}
out.push(elem.tagName.toLowerCase());
if (elem.id) {
out.push("#" + elem.id);
}
className = elem.className;
if (className && is_1.isString(className)) {
classes = className.split(/\s+/);
for (i = 0; i < classes.length; i++) {
out.push("." + classes[i]);
}
}
var attrWhitelist = ['type', 'name', 'title', 'alt'];
for (i = 0; i < attrWhitelist.length; i++) {
key = attrWhitelist[i];
attr = elem.getAttribute(key);
if (attr) {
out.push("[" + key + "=\"" + attr + "\"]");
}
}
return out.join('');
}
exports.htmlElementAsString = htmlElementAsString;
/**
* Parses string form of URL into an object

@@ -195,3 +124,3 @@ * // borrowed from https://tools.ietf.org/html/rfc3986#appendix-B

var global = getGlobalObject();
var levels = ['debug', 'info', 'warn', 'error', 'log'];
var levels = ['debug', 'info', 'warn', 'error', 'log', 'assert'];
if (!('console' in global)) {

@@ -198,0 +127,0 @@ return callback();

2

dist/object.js

@@ -14,3 +14,3 @@ "use strict";

function fill(source, name, replacement) {
if (!(name in source) || source[name].__sentry__) {
if (!(name in source)) {
return;

@@ -17,0 +17,0 @@ }

@@ -28,3 +28,3 @@ /// <reference types="node" />

*/
export declare function getGlobalObject<T extends Window | NodeJS.Global = any>(): T & SentryGlobal;
export declare function getGlobalObject<T>(): T & SentryGlobal;
/**

@@ -37,15 +37,2 @@ * UUID4 generator

/**
* Given a child DOM element, returns a query-selector statement describing that
* and its ancestors
* e.g. [HTMLElement] => body > div > input#foo.btn[name=baz]
* @returns generated DOM path
*/
export declare function htmlTreeAsString(elem: Node): string;
/**
* Returns a simple, query-selector representation of a DOM element
* e.g. [HTMLElement] => input#foo.btn[name=baz]
* @returns generated DOM path
*/
export declare function htmlElementAsString(elem: HTMLElement): string;
/**
* Parses string form of URL into an object

@@ -52,0 +39,0 @@ * // borrowed from https://tools.ietf.org/html/rfc3986#appendix-B

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

import { isString } from './is';
/**

@@ -25,3 +24,2 @@ * Requires a module which is protected _against bundler minification.

*/
// tslint:disable:strict-type-predicates
export function getGlobalObject() {

@@ -73,69 +71,2 @@ return (isNodeEnv()

/**
* Given a child DOM element, returns a query-selector statement describing that
* and its ancestors
* e.g. [HTMLElement] => body > div > input#foo.btn[name=baz]
* @returns generated DOM path
*/
export function htmlTreeAsString(elem) {
var currentElem = elem;
var MAX_TRAVERSE_HEIGHT = 5;
var MAX_OUTPUT_LEN = 80;
var out = [];
var height = 0;
var len = 0;
var separator = ' > ';
var sepLength = separator.length;
var nextStr;
while (currentElem && height++ < MAX_TRAVERSE_HEIGHT) {
nextStr = htmlElementAsString(currentElem);
// bail out if
// - nextStr is the 'html' element
// - the length of the string that would be created exceeds MAX_OUTPUT_LEN
// (ignore this limit if we are on the first iteration)
if (nextStr === 'html' || (height > 1 && len + out.length * sepLength + nextStr.length >= MAX_OUTPUT_LEN)) {
break;
}
out.push(nextStr);
len += nextStr.length;
currentElem = currentElem.parentNode;
}
return out.reverse().join(separator);
}
/**
* Returns a simple, query-selector representation of a DOM element
* e.g. [HTMLElement] => input#foo.btn[name=baz]
* @returns generated DOM path
*/
export function htmlElementAsString(elem) {
var out = [];
var className;
var classes;
var key;
var attr;
var i;
if (!elem || !elem.tagName) {
return '';
}
out.push(elem.tagName.toLowerCase());
if (elem.id) {
out.push("#" + elem.id);
}
className = elem.className;
if (className && isString(className)) {
classes = className.split(/\s+/);
for (i = 0; i < classes.length; i++) {
out.push("." + classes[i]);
}
}
var attrWhitelist = ['type', 'name', 'title', 'alt'];
for (i = 0; i < attrWhitelist.length; i++) {
key = attrWhitelist[i];
attr = elem.getAttribute(key);
if (attr) {
out.push("[" + key + "=\"" + attr + "\"]");
}
}
return out.join('');
}
/**
* Parses string form of URL into an object

@@ -185,3 +116,3 @@ * // borrowed from https://tools.ietf.org/html/rfc3986#appendix-B

var global = getGlobalObject();
var levels = ['debug', 'info', 'warn', 'error', 'log'];
var levels = ['debug', 'info', 'warn', 'error', 'log', 'assert'];
if (!('console' in global)) {

@@ -188,0 +119,0 @@ return callback();

@@ -12,3 +12,3 @@ import { isError, isPrimitive, isSyntheticEvent } from './is';

export function fill(source, name, replacement) {
if (!(name in source) || source[name].__sentry__) {
if (!(name in source)) {
return;

@@ -15,0 +15,0 @@ }

{
"name": "@sentry/utils",
"version": "5.0.6",
"version": "5.0.7",
"description": "Utilities for all Sentry JavaScript SDKs",

@@ -5,0 +5,0 @@ "repository": "git://github.com/getsentry/sentry-javascript.git",

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