-
Notifications
You must be signed in to change notification settings - Fork 44
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
fix: Remove slugify dependency #786
fix: Remove slugify dependency #786
Conversation
Closing and reopening to re-run checks |
src/utils.ts
Outdated
// TODO: Refactor this to a regex | ||
const isDataPlanSlug = (str: string): boolean => | ||
isString(str) && str === slugify(str); | ||
const toSlug = (value: any): string => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically these are not slugs, because slugs can have hyphens. I think we should really call this something more specific to our purposes. I see the backend uses the term PlanSlug
, which because it's in a file named DataPlan might make sense, so I think the following is a goodr renaming:
const toSlug = (value: any): string => | |
const toDataPlanSlug = (value: any): string => |
src/utils.ts
Outdated
.replace(/[^0-9a-zA-Z]+/g, '_') | ||
: ''; | ||
|
||
const isDataPlanSlug = (str: string): boolean => str === toSlug(str); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const isDataPlanSlug = (str: string): boolean => str === toSlug(str); | |
const isDataPlanSlug = (str: string): boolean => str === toDataPlanSlug(str); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good overall. I think just renaming it would make most sense since a slug can be hyphenated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd recommend also removing slugify from package.json, doing an npm install, and also commiting the package-lock.json
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
## [2.23.6](v2.23.5...v2.23.6) (2023-10-17) ### Bug Fixes * Remove slugify dependency ([#786](#786)) ([8346bdc](8346bdc))
🎉 This PR is included in version 2.23.6 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Instructions
development
Summary
Slugify
without using any polyfills or JS functions that are incompatible with ES5.Testing Plan
Invalid Data Plan Slug
Valid Data Plan Slug
Reference Issue (For mParticle employees only. Ignore if you are an outside contributor)