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

feat(util): Add stringMatchesSomePattern helper function. #6205

Merged
merged 3 commits into from Nov 15, 2022

Conversation

lobsterkatie
Copy link
Member

@lobsterkatie lobsterkatie commented Nov 15, 2022

This adds a new utility function, stringMatchesSomePattern, which tests a string against an entire array of strings and/or regexes at once (which is something we do in a number of spots in the SDK). It also adds an optional parameter to isMatchingPattern to allow the string matching to be exact rather than a substring match.

The primary purpose of adding this is to make code a little easier to read. (I had hoped it would also possibly save us a few bytes, and adding the helper function does, but unfortunately that's canceled out by the new exact-match option, so in the end it's more or less a wash on that score.)

@github-actions
Copy link
Contributor

github-actions bot commented Nov 15, 2022

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 19.51 KB (+0.07% 🔺)
@sentry/browser - ES5 CDN Bundle (minified) 60.36 KB (+0.05% 🔺)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.17 KB (+0.09% 🔺)
@sentry/browser - ES6 CDN Bundle (minified) 53.71 KB (+0.03% 🔺)
@sentry/browser - Webpack (gzipped + minified) 19.9 KB (+0.04% 🔺)
@sentry/browser - Webpack (minified) 65.12 KB (+0.04% 🔺)
@sentry/react - Webpack (gzipped + minified) 19.93 KB (+0.07% 🔺)
@sentry/nextjs Client - Webpack (gzipped + minified) 45.89 KB (+0.03% 🔺)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 26.33 KB (+0.03% 🔺)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 24.74 KB (+0.06% 🔺)

@lobsterkatie lobsterkatie force-pushed the kmclb-add-stringMatchesSomePattern-helper branch from 5d5d1e9 to 58afac0 Compare November 15, 2022 14:32
@lobsterkatie lobsterkatie merged commit 6627882 into master Nov 15, 2022
@lobsterkatie lobsterkatie deleted the kmclb-add-stringMatchesSomePattern-helper branch November 15, 2022 15:12
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

3 participants