You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug Report: Incorrect Title Formatting for Hyphenated and Apostrophe Words
Describe the bug
When formatting job titles that include hyphens or apostrophes (e.g., "t-mobile", "coca-cola", "e-commerce"), the TitleCaser returns incorrect results (e.g., "t[mobile", "coca[cola", "e[commerce") due to an incorrect joiner being used when reassembling the split word parts.
To Reproduce
Steps to reproduce the behavior:
Use the TitleCaser on strings such as "t-mobile", "coca-cola", or "e-commerce".
Execute the tests (e.g., run npm test or a similar command).
Observe that the output is incorrect: instead of "T-Mobile", "Coca-Cola", or "E-Commerce", the returned strings contain a "[" character (e.g., "t[mobile").
Expected behavior
The TitleCaser should correctly reassemble the split word parts using the proper delimiter. For instance:
"t-mobile" should be transformed into "T-Mobile".
"coca-cola" should be transformed into "Coca-Cola".
"e-commerce" should be transformed into "E-Commerce".
Screenshots
If applicable, add screenshots to help explain your problem. (No screenshots provided)
Desktop (please complete the following information):
OS: macOS / Windows / Linux
Browser: N/A (issue appears in a Node.js environment)
Version: v1.7.0
Smartphone (please complete the following information):
Device: N/A
OS: N/A
Browser: N/A
Version: N/A
Additional context
The bug is caused by the correctTerm function in the TitleCaserUtils class. It uses delimiters.source.charAt(0) to join the parts after splitting the word. When using the default delimiter regex /[-']/, delimiters.source.charAt(0) returns "[" instead of the expected hyphen or apostrophe. The solution was to determine the correct joiner based on whether the original word includes a hyphen or an apostrophe.
The text was updated successfully, but these errors were encountered:
Bug Report: Incorrect Title Formatting for Hyphenated and Apostrophe Words
Describe the bug
When formatting job titles that include hyphens or apostrophes (e.g., "t-mobile", "coca-cola", "e-commerce"), the TitleCaser returns incorrect results (e.g.,
"t[mobile"
,"coca[cola"
,"e[commerce"
) due to an incorrect joiner being used when reassembling the split word parts.To Reproduce
Steps to reproduce the behavior:
"t-mobile"
,"coca-cola"
, or"e-commerce"
.npm test
or a similar command)."T-Mobile"
,"Coca-Cola"
, or"E-Commerce"
, the returned strings contain a"["
character (e.g.,"t[mobile"
).Expected behavior
The TitleCaser should correctly reassemble the split word parts using the proper delimiter. For instance:
"t-mobile"
should be transformed into"T-Mobile"
."coca-cola"
should be transformed into"Coca-Cola"
."e-commerce"
should be transformed into"E-Commerce"
.Screenshots
If applicable, add screenshots to help explain your problem.
(No screenshots provided)
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
The bug is caused by the
correctTerm
function in the TitleCaserUtils class. It usesdelimiters.source.charAt(0)
to join the parts after splitting the word. When using the default delimiter regex/[-']/
,delimiters.source.charAt(0)
returns"["
instead of the expected hyphen or apostrophe. The solution was to determine the correct joiner based on whether the original word includes a hyphen or an apostrophe.The text was updated successfully, but these errors were encountered: