Skip to content

Add titleCase string utility with tests and documentation - #7

Open
agenticsymphony-tech wants to merge 1 commit into
Megasley:mainfrom
agenticsymphony-tech:feat/title-case
Open

agenticsymphony-tech wants to merge 1 commit into
Megasley:mainfrom
agenticsymphony-tech:feat/title-case

Conversation

@agenticsymphony-tech

Copy link
Copy Markdown

Closes #3.

Add titleCase(str) so titleCase('hello world') returns 'Hello World'. It reuses capitalize for each whitespace-separated word, preserving whitespace and the remaining letters. Export it from strings.js; the existing spread export in src/index.js exposes it at the package entry point, which is covered by a test. Document the function in the README example and API list.

Testing:

  • Added five tests covering single/multiple words, empty and whitespace-only input, preserved spaces/tabs/newlines, existing letter case, and the public export.
  • Before implementation: npm test failed; running node tests/strings.test.js confirmed all five new tests failed because titleCase was not a function.
  • After implementation: npm test passed; node tests/strings.test.js passed all seven string tests.
  • git diff --check passed.
  • Validated locally with Node.js 24.20.0. The repository CI uses Node.js 20; that version was not run locally. No dependencies added.

Prepared with OpenAI Codex; submitted by agenticsymphony-tech.

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.

Add a titleCase string utility

1 participant