Skip to content

Conversation

@Eazash
Copy link

@Eazash Eazash commented Jan 15, 2025

Partially fixes #95 and #92 (marking as partial fixes as they also exhibit the issue in #101)

Resolves #96

splitByCase has inconsistent behaviour when dealing with whitespaces. Adding whitespace as a separator character fixes these issues, which are also causing the inconsistent spacing behavior in titleCase

A few things to note

console.log(`${JSON.stringify(splitByCase("FOO BAR"))} -- ${titleCase("FOO BAR")}`) 
console.log(`${JSON.stringify(splitByCase("foo bar"))} -- ${titleCase("foo bar")}`) 
console.log(`${JSON.stringify(splitByCase("foO bar"))} -- ${titleCase("foO bar")}`) 

/** Before **/
// ["FO","O ","BAR"] -- FO O  BAR
// ["foo bar"] -- Foo bar
// ["fo","O bar"] -- Fo O bar

/** After **/
// ["FOO","BAR"] -- FOO BAR
// ["foo","bar"] -- Foo Bar
// ["fo","O","bar"] -- Fo O Bar

Based on both #98 and #97 🫡

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

titleCase insert extra space when convert a valid titleCase string Inconsistent casing

1 participant