@sentry/utils
Advanced tools
Comparing version 5.11.0 to 5.11.1
@@ -1,2 +0,2 @@ | ||
import { Event, Integration } from '@sentry/types'; | ||
import { Event, Integration, StackFrame } from '@sentry/types'; | ||
/** Internal */ | ||
@@ -119,3 +119,11 @@ interface SentryGlobal { | ||
export declare function getFunctionName(fn: unknown): string; | ||
/** | ||
* This function adds context (pre/post/line) lines to the provided frame | ||
* | ||
* @param lines string[] containing all lines | ||
* @param frame StackFrame that will be mutated | ||
* @param linesOfContext number of context lines we want to add pre/post | ||
*/ | ||
export declare function addContextToFrame(lines: string[], frame: StackFrame, linesOfContext?: number): void; | ||
export {}; | ||
//# sourceMappingURL=misc.d.ts.map |
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var is_1 = require("./is"); | ||
var string_1 = require("./string"); | ||
/** | ||
@@ -339,2 +340,23 @@ * Requires a module which is protected _against bundler minification. | ||
exports.getFunctionName = getFunctionName; | ||
/** | ||
* This function adds context (pre/post/line) lines to the provided frame | ||
* | ||
* @param lines string[] containing all lines | ||
* @param frame StackFrame that will be mutated | ||
* @param linesOfContext number of context lines we want to add pre/post | ||
*/ | ||
function addContextToFrame(lines, frame, linesOfContext) { | ||
if (linesOfContext === void 0) { linesOfContext = 5; } | ||
var lineno = frame.lineno || 0; | ||
var maxLines = lines.length; | ||
var sourceLine = Math.max(Math.min(maxLines, lineno - 1), 0); | ||
frame.pre_context = lines | ||
.slice(Math.max(0, sourceLine - linesOfContext), sourceLine) | ||
.map(function (line) { return string_1.snipLine(line, 0); }); | ||
frame.context_line = string_1.snipLine(lines[Math.min(maxLines - 1, sourceLine)], frame.colno || 0); | ||
frame.post_context = lines | ||
.slice(Math.min(sourceLine + 1, maxLines), sourceLine + 1 + linesOfContext) | ||
.map(function (line) { return string_1.snipLine(line, 0); }); | ||
} | ||
exports.addContextToFrame = addContextToFrame; | ||
//# sourceMappingURL=misc.js.map |
@@ -1,2 +0,2 @@ | ||
import { Event, Integration } from '@sentry/types'; | ||
import { Event, Integration, StackFrame } from '@sentry/types'; | ||
/** Internal */ | ||
@@ -119,3 +119,11 @@ interface SentryGlobal { | ||
export declare function getFunctionName(fn: unknown): string; | ||
/** | ||
* This function adds context (pre/post/line) lines to the provided frame | ||
* | ||
* @param lines string[] containing all lines | ||
* @param frame StackFrame that will be mutated | ||
* @param linesOfContext number of context lines we want to add pre/post | ||
*/ | ||
export declare function addContextToFrame(lines: string[], frame: StackFrame, linesOfContext?: number): void; | ||
export {}; | ||
//# sourceMappingURL=misc.d.ts.map |
import { isString } from './is'; | ||
import { snipLine } from './string'; | ||
/** | ||
@@ -323,2 +324,22 @@ * Requires a module which is protected _against bundler minification. | ||
} | ||
/** | ||
* This function adds context (pre/post/line) lines to the provided frame | ||
* | ||
* @param lines string[] containing all lines | ||
* @param frame StackFrame that will be mutated | ||
* @param linesOfContext number of context lines we want to add pre/post | ||
*/ | ||
export function addContextToFrame(lines, frame, linesOfContext) { | ||
if (linesOfContext === void 0) { linesOfContext = 5; } | ||
var lineno = frame.lineno || 0; | ||
var maxLines = lines.length; | ||
var sourceLine = Math.max(Math.min(maxLines, lineno - 1), 0); | ||
frame.pre_context = lines | ||
.slice(Math.max(0, sourceLine - linesOfContext), sourceLine) | ||
.map(function (line) { return snipLine(line, 0); }); | ||
frame.context_line = snipLine(lines[Math.min(maxLines - 1, sourceLine)], frame.colno || 0); | ||
frame.post_context = lines | ||
.slice(Math.min(sourceLine + 1, maxLines), sourceLine + 1 + linesOfContext) | ||
.map(function (line) { return snipLine(line, 0); }); | ||
} | ||
//# sourceMappingURL=misc.js.map |
{ | ||
"name": "@sentry/utils", | ||
"version": "5.11.0", | ||
"version": "5.11.1", | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
451312
5501