Skip to content

Commit

Permalink
ref(utils): use readonly value so we dont mutate arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasBa committed Mar 10, 2023
1 parent b6bbf0f commit d0cafb5
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions packages/utils/src/stacktrace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,12 @@ export function stackParserFromStackParserOptions(stackParser: StackParser | Sta
/**
* @hidden
*/
export function stripSentryFramesAndReverse(stack: StackFrame[]): StackFrame[] {
export function stripSentryFramesAndReverse(stack: ReadonlyArray<StackFrame>): StackFrame[] {
if (!stack.length) {
return [];
}

let localStack = stack;

if (stack.length >= STACKTRACE_LIMIT) {
localStack.slice(0, STACKTRACE_LIMIT);
}
let localStack = stack.slice(0, STACKTRACE_LIMIT);

const lastFrameFunction = localStack[localStack.length - 1].function;
// If stack ends with one of our internal API calls, remove it (ends, meaning it's the bottom of the stack - aka top-most call)
Expand Down

0 comments on commit d0cafb5

Please sign in to comment.