-
Notifications
You must be signed in to change notification settings - Fork 3
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
MC-1583:"Fix Title” for English titles not capitalizing first word after single quote or colon #1223
Conversation
… after single quote or colon
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.
functionally this looks great - hoping we can add some comments and targeted unit tests 😄
// Boolean here acts as a callback, evaluates each word: | ||
// If it's a non-empty string, keep the word in the array; | ||
// If it's an empty string (or falsy), remove from array. | ||
const allWords = value.split(SEPARATORS).filter(Boolean); // Split and filter empty strings |
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.
just out of curiosity, what is the filter(Boolean)
guarding against?
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.
filter(Boolean)
removes any false
values like NaN
, undefined
, etc
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.
but could those values ever appear in a split string? doesn't hurt to have it in, just wondering if you came across a case where something falsy ended up in the array. 😅
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.
great work, and love the comments and tests!
Goal
Fix the capitalization rules for english titles:
'the day'
->'The Day'
'the day' day'S
->'The Day' Day's
the day' day's: day
->'The Day' Day's: Day
Final result:
Amorim aims to 'prove something' at Manchester United after agreeing deal: read the day's 'news'
->Amorim Aims to ‘Prove Something’ at Manchester United After Agreeing Deal: Read the Day’s ‘News’
Todos
Reference
Tickets: