title icon indicating copy to clipboard operation
title copied to clipboard

refactor: extract complex regex into separate title-regex module

Open callmegautam opened this issue 7 months ago • 0 comments

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.ts to import and use titleRegex
  • 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.

callmegautam avatar Jun 21 '25 16:06 callmegautam