Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Replace indexOf in favour of includes in isMatchingPattern #5389

Closed
wants to merge 1 commit into from

Conversation

dashed
Copy link
Member

@dashed dashed commented Jul 7, 2022

My small contribution to making the JS SDK bundle smaller.

@dashed dashed requested review from AbhiPrasad and a team July 7, 2022 20:21
@dashed dashed self-assigned this Jul 7, 2022
@dashed dashed requested review from Lms24 and removed request for a team July 7, 2022 20:21
@@ -97,7 +97,7 @@ export function isMatchingPattern(value: string, pattern: RegExp | string): bool
return pattern.test(value);
}
if (typeof pattern === 'string') {
return value.indexOf(pattern) !== -1;
return value.includes(pattern);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't work in IE11 - and we don't want folks to require the polyfill even when they downcompile

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. I saw some usage of String.includes() elsewhere in the SDK. I thought it was fair game.

@github-actions
Copy link
Contributor

github-actions bot commented Jul 7, 2022

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 19.33 KB (-0.04% 🔽)
@sentry/browser - ES5 CDN Bundle (minified) 59.86 KB (-0.01% 🔽)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 17.93 KB (-0.04% 🔽)
@sentry/browser - ES6 CDN Bundle (minified) 52.77 KB (-0.01% 🔽)
@sentry/browser - Webpack (gzipped + minified) 19.71 KB (+0.01% 🔺)
@sentry/browser - Webpack (minified) 64.15 KB (-0.01% 🔽)
@sentry/react - Webpack (gzipped + minified) 19.73 KB (+0.01% 🔺)
@sentry/nextjs Client - Webpack (gzipped + minified) 43.92 KB (-0.01% 🔽)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 25.7 KB (-0.03% 🔽)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 23.97 KB (-0.03% 🔽)

@dashed dashed closed this Jul 7, 2022
@AbhiPrasad AbhiPrasad deleted the alberto/isMatchingPattern branch January 30, 2023 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants