Skip to content

Commit 2d9a0bd

Browse files
committed
ref: Remove includes method usage
1 parent 41ac166 commit 2d9a0bd

File tree

7 files changed

+8
-32
lines changed

7 files changed

+8
-32
lines changed

packages/browser/src/integrations/breadcrumbs.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ export class Breadcrumbs implements Integration {
236236
const filterUrl = new API(dsn).getStoreEndpoint();
237237
// if Sentry key appears in URL, don't capture it as a request
238238
// but rather as our own 'sentry' type breadcrumb
239-
if (filterUrl && url.includes(filterUrl)) {
239+
if (filterUrl && url.indexOf(filterUrl) !== -1) {
240240
if (method === 'POST' && args[1] && args[1].body) {
241241
addSentryBreadcrumb(args[1].body);
242242
}
@@ -407,7 +407,7 @@ export class Breadcrumbs implements Integration {
407407
const filterUrl = new API(dsn).getStoreEndpoint();
408408
// if Sentry key appears in URL, don't capture it as a request
409409
// but rather as our own 'sentry' type breadcrumb
410-
if (isString(url) && (filterUrl && url.includes(filterUrl))) {
410+
if (isString(url) && (filterUrl && url.indexOf(filterUrl) !== -1)) {
411411
this.__sentry_own_request__ = true;
412412
}
413413
}

packages/browser/src/parsers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,12 @@ export function prepareFramesForEvent(stack: TraceKitStackFrame[]): StackFrame[]
8080
const lastFrameFunction = localStack[localStack.length - 1].func || '';
8181

8282
// If stack starts with one of our API calls, remove it (starts, meaning it's the top of the stack - aka last call)
83-
if (firstFrameFunction.includes('captureMessage') || firstFrameFunction.includes('captureException')) {
83+
if (firstFrameFunction.indexOf('captureMessage') !== -1 || firstFrameFunction.indexOf('captureException') !== -1) {
8484
localStack = localStack.slice(1);
8585
}
8686

8787
// 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)
88-
if (lastFrameFunction.includes('sentryWrapped')) {
88+
if (lastFrameFunction.indexOf('sentryWrapped') !== -1) {
8989
localStack = localStack.slice(0, -1);
9090
}
9191

packages/browser/test/integration/polyfills/includes.js

Lines changed: 0 additions & 23 deletions
This file was deleted.

packages/browser/test/integration/run.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ function build() {
7777
"polyfills/events.js",
7878
"polyfills/assign.js",
7979
"polyfills/nan.js",
80-
"polyfills/includes.js",
8180
]);
8281

8382
writeFile(

packages/node/src/integrations/http.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ function emitWrapper(origEmit: EventListener): (event: string, response: http.Se
142142
const dsn = client.getDsn();
143143

144144
const isInterestingEvent = event === 'response' || event === 'error';
145-
const isNotSentryRequest = dsn && this.__ravenBreadcrumbUrl && !this.__ravenBreadcrumbUrl.includes(dsn.host);
145+
const isNotSentryRequest = dsn && this.__ravenBreadcrumbUrl && this.__ravenBreadcrumbUrl.indexOf(dsn.host) === -1;
146146

147147
if (isInterestingEvent && isNotSentryRequest && getCurrentHub().getIntegration(Http)) {
148148
getCurrentHub().addBreadcrumb(

packages/node/src/parsers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ export function parseStack(stack: stacktrace.StackFrame[], options?: NodeOptions
157157
// note that isNative appears to return true even for node core libraries
158158
// see https://github.com/getsentry/raven-node/issues/176
159159
parsedFrame.in_app =
160-
!isInternal && parsedFrame.filename !== undefined && !parsedFrame.filename.includes('node_modules/');
160+
!isInternal && parsedFrame.filename !== undefined && parsedFrame.filename.indexOf('node_modules/') === -1;
161161

162162
// Extract a module name based on the filename
163163
if (parsedFrame.filename) {
@@ -271,7 +271,7 @@ export function prepareFramesForEvent(stack: StackFrame[]): StackFrame[] {
271271
let localStack = stack;
272272
const firstFrameFunction = localStack[0].function || '';
273273

274-
if (firstFrameFunction.includes('captureMessage') || firstFrameFunction.includes('captureException')) {
274+
if (firstFrameFunction.indexOf('captureMessage') !== -1 || firstFrameFunction.indexOf('captureException') !== -1) {
275275
localStack = localStack.slice(1);
276276
}
277277

packages/utils/src/string.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export function isMatchingPattern(value: string, pattern: RegExp | string): bool
117117
return (pattern as RegExp).test(value);
118118
}
119119
if (typeof pattern === 'string') {
120-
return value.includes(pattern);
120+
return value.indexOf(pattern) !== -1;
121121
}
122122
return false;
123123
}

0 commit comments

Comments
 (0)