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(utils): Add function for ensuring input is an array #5668

Merged
merged 3 commits into from Sep 1, 2022

Conversation

lobsterkatie
Copy link
Member

In a number of places in our codebase, we have the pattern const something = Array.isArray(somethingElse) ? somethingElse : [ somethingElse ];, where we need something (which might already be an array) to be an array.

This introduces a utility function, arrayify, which does that work for us, mostly because I just got tired of typing it. (As a bonus, it's slightly shorter and therefore might save a few bytes on bundle size.)

@github-actions
Copy link
Contributor

github-actions bot commented Sep 1, 2022

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 19.42 KB (-0.04% 🔽)
@sentry/browser - ES5 CDN Bundle (minified) 60.08 KB (-0.02% 🔽)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 17.99 KB (-0.02% 🔽)
@sentry/browser - ES6 CDN Bundle (minified) 52.94 KB (-0.03% 🔽)
@sentry/browser - Webpack (gzipped + minified) 19.79 KB (-0.01% 🔽)
@sentry/browser - Webpack (minified) 64.33 KB (-0.02% 🔽)
@sentry/react - Webpack (gzipped + minified) 19.81 KB (-0.02% 🔽)
@sentry/nextjs Client - Webpack (gzipped + minified) 44.72 KB (-0.02% 🔽)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 25.91 KB (-0.01% 🔽)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 24.28 KB (0%)

@lobsterkatie lobsterkatie merged commit e6e89fd into master Sep 1, 2022
@lobsterkatie lobsterkatie deleted the kmclb-add-arrayify-util-function branch September 1, 2022 06:00
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