-
Notifications
You must be signed in to change notification settings - Fork 12
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(titleCase): insert extra space when convert valid string #97
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #97 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 2 2
Lines 340 409 +69
Branches 39 45 +6
=========================================
+ Hits 340 409 +69 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
@@ -140,6 +147,7 @@ describe("titleCase", () => { | |||
["foo", "Foo"], | |||
["foo-bar", "Foo Bar"], | |||
["this-IS-aTitle", "This is a Title"], | |||
["Foo Bar", "Foo Bar"], |
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.
Maybe add at least to types test as well? (for types we can do simply similar fix with trim should be fine)
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 made some changes to types and added types test cases for TrainCase
and TitleCase
(TrainCase with space joiner).
There are still two cases didn't pass. That's because titleCase
and trainCase
use filter(Boolean)
to filter empty string. I don't know how to fix the type properly so I add a @ts-expect-error
comment above it.
Could you do some help?
5afdbbb
to
80248aa
Compare
80248aa
to
a9cbd9a
Compare
@@ -54,15 +54,15 @@ export function splitByCase< | |||
if (previousSplitter === false) { | |||
// Case rising edge | |||
if (previousUpper === false && isUpper === true) { | |||
parts.push(buff); | |||
parts.push(buff.trim()); |
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'm wondering if we could fix algorithm that does not add trailing space in first place?
This PR resolves #96 and adds test cases for other converters while convert valid string.