Skip to content
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

feat(splitByCase): add whitespace as a string splitter character #102

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

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