Skip to content

Commit d0cafb5

Browse files
committed
ref(utils): use readonly value so we dont mutate arguments
1 parent b6bbf0f commit d0cafb5

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

packages/utils/src/stacktrace.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,12 @@ export function stackParserFromStackParserOptions(stackParser: StackParser | Sta
5757
/**
5858
* @hidden
5959
*/
60-
export function stripSentryFramesAndReverse(stack: StackFrame[]): StackFrame[] {
60+
export function stripSentryFramesAndReverse(stack: ReadonlyArray<StackFrame>): StackFrame[] {
6161
if (!stack.length) {
6262
return [];
6363
}
6464

65-
let localStack = stack;
66-
67-
if (stack.length >= STACKTRACE_LIMIT) {
68-
localStack.slice(0, STACKTRACE_LIMIT);
69-
}
65+
let localStack = stack.slice(0, STACKTRACE_LIMIT);
7066

7167
const lastFrameFunction = localStack[localStack.length - 1].function;
7268
// 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)

0 commit comments

Comments
 (0)