title
title copied to clipboard
refactor: extract complex regex into separate title-regex module
Summary
Closes #94
This PR refactors the complex regex logic in src/index.ts by extracting it into a dedicated title-regex.ts module.
Changes
- Created a new module
src/title-regex.ts - Moved named regex parts (
wordChar,leadBoundary, and the full regex) to that file - Updated
src/index.tsto import and usetitleRegex - Added inline comments for maintainability
- No behavioral changes — output remains 100% the same
Why
Keeping the core title formatting logic clean and focused is important for readability. The regex was technically correct but hard to maintain or update. By moving it to a separate module and naming its parts, it's now easier for future contributors to work with and reason about.
Let me know if you want this module renamed or merged back into index.ts — open to changes.