Skip to content

Commit 00a52f9

Browse files
committed
fix(integrations): Replace possibly expensive regex with string.includes
1 parent e55cfa3 commit 00a52f9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/integrations/src/rewriteframes.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,9 @@ export class RewriteFrames implements Integration {
7272
return frame;
7373
}
7474
// Determine if this is a Windows frame by checking for a Windows-style prefix such as `C:\`
75-
// or the presence of a backslash without a forward slash (which are not allowed on Windows)
76-
const isWindowsFrame = /^[a-zA-Z]:\\/.test(frame.filename) || /^(?!.*\/).*\\.*$/.test(frame.filename);
75+
const isWindowsFrame = /^[a-zA-Z]:\\/.test(frame.filename) ||
76+
// or the presence of a backslash without a forward slash (which are not allowed on Windows)
77+
(frame.filename.includes('\\') && !frame.filename.includes('/'));
7778
// Check if the frame filename begins with `/`
7879
const startsWithSlash = /^\//.test(frame.filename);
7980
if (isWindowsFrame || startsWithSlash) {

0 commit comments

Comments
 (0)