-
-
Notifications
You must be signed in to change notification settings - Fork 38
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
Refactor CamelCaseToSeparator Filter #186
Conversation
Had another look at the regex - I think this is more like it: https://3v4l.org/ISIYe |
Signed-off-by: ramchale <[email protected]>
b79a399
to
266111f
Compare
Awesome. Hadn't seen this before I created the additional draft. I'd put in my own unicode example, but your change seems to work for that as well 😄 |
Signed-off-by: ramchale <[email protected]>
@froschdesign Can I have your opinion on the use of I can't decide if input like 'Foo-Bar' should be filtered to 'Foo-Bar' or 'Foo---Bar' - I'm currently preferring the latter because it is consistent with 'Foo/Bar' => 'Foo-/-Bar'. WDYT? |
A third option is to add an entry to the constructor Options (something like |
If we're doing extra options - it would be better to perhaps to add
Also, remember that filter chain can be used, i.e. |
Signed-off-by: ramchale <[email protected]>
Updated this in line with the conversation so far. Let me know if it needs further changes |
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.
Some changes to the documentation are required.
docs/book/v3/migration/v2-to-v3.md
Outdated
- `setSeparator` | ||
- `getSeparator` | ||
|
||
The filter will now treat numbers as a word boundary. For example `ThisHas4Words` will filter to `This-Has-4-Words` |
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 new behaviour is not covered in the documentation. Example:
TIP: **New Behaviour since Version 3**
The filter will now treat numbers as a word boundary.
For example `ThisHas4Words` will filter to `This-Has-4-Words`.
docs/book/v3/migration/v2-to-v3.md
Outdated
- `setSeparator` | ||
- `getSeparator` | ||
|
||
The filter will now treat numbers as a word boundary. For example `ThisHas4Words` with the default separator will filter to `This Has 4 Words` |
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 new behaviour is not covered in the documentation.
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.
The note on constructor options is missing:
The constructor now only accepts an associative array of [documented options](../word.md#camelcasetoseparator).
docs/book/v3/migration/v2-to-v3.md
Outdated
- `setSeparator` | ||
- `getSeparator` | ||
|
||
The filter will now treat numbers as a word boundary. For example `ThisHas4Words` will filter to `This_Has_4_Words` |
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 new behaviour is not covered in the documentation.
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.
LGTM! Thanks @ramchale
I'll wait for @froschdesign to approve the docs changes - I think behaviour wise, what we have is fine and any weird results from users supplying input that is not camel cased is the users problem.
@gsteel awesome, thanks. I think you solved the trickiest bit 😄 |
@gsteel |
Signed-off-by: ramchale <[email protected]>
bb45d13
to
9a91b32
Compare
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.
Thanks again @ramchale 👍
Description
Refactoring CamelCaseToSeparator based on #177