Skip to content

refactor(inflekt): remove camelize, standardize on toCamelCase/toPascalCase#72

Merged
pyramation merged 2 commits intomainfrom
devin/1774491087-consolidate-camelize-api
Mar 26, 2026
Merged

refactor(inflekt): remove camelize, standardize on toCamelCase/toPascalCase#72
pyramation merged 2 commits intomainfrom
devin/1774491087-consolidate-camelize-api

Conversation

@pyramation
Copy link
Copy Markdown
Contributor

@pyramation pyramation commented Mar 26, 2026

Summary

Breaking change: Completely removes the camelize(str, lowFirstLetter?) function from inflekt. The case-conversion API now exposes two declarative functions with no boolean parameters:

  • toCamelCase(str) — always returns camelCase
  • toPascalCase(str) — always returns PascalCase

Both handle _, -, and existing camelCase/PascalCase boundaries. The old camelize implementation only split on _; the new functions use a regex (/[-_](.)/g) that also handles -.

Tests (88 passing), README, and JSDoc comments are all updated. No version bump — Dan will handle versioning when publishing.

Updates since last revision

  • Deleted camelize entirely instead of deprecating it (per reviewer feedback: "DELETE THE OLD SHIT")
  • Removed camelize from test imports, deleted its test suite (3 test cases removed)
  • Removed deprecated camelize line from README API section
  • Reverted version to 0.5.0 (no bump)

Review & Testing Checklist for Human

  • Breaking change for downstream consumers: Any code importing camelize from inflekt will fail at compile time. Verify the companion PR (constructive#897) migrates all call sites before publishing.
  • Verify camelize is fully removed from src/index.ts re-exports: Confirm it's not still listed in the barrel export, which would cause a build error.
  • Regex behavioral difference: The old camelize used .split('_').map(...) while toPascalCase/toCamelCase use /[-_](.)/g. Inputs with double underscores (foo__bar), trailing delimiters (foo_), or other edge cases will behave differently. The audit found only clean snake_case inputs in practice — verify this holds for your codebase.

Suggested test plan: Run pnpm test in packages/inflekt, then grep across constructive for any remaining camelize imports before publishing.

Notes

  • Companion PR in constructive (#897) migrates all ~30 camelize() call sites to toCamelCase/toPascalCase. That PR must land before or alongside this one.
  • toScreamingSnake was added in a prior PR but is now properly documented and tested here.

Link to Devin session: https://app.devin.ai/sessions/e3dd5ed7753043bd8d2166793364cd42
Requested by: @pyramation

- toCamelCase and toPascalCase are now the primary API (handle both _ and - delimiters)
- camelize is deprecated and delegates to toCamelCase/toPascalCase internally
- Updated all tests and docs to use the new declarative API
- No boolean second parameter - use toCamelCase() or toPascalCase() directly
@devin-ai-integration
Copy link
Copy Markdown

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Delete the deprecated camelize() function instead of keeping it as a
wrapper. Remove all camelize references from tests and README docs.
Dan will handle version bumping.
@devin-ai-integration devin-ai-integration bot changed the title refactor(inflekt): consolidate camelize into toCamelCase/toPascalCase refactor(inflekt): remove camelize, standardize on toCamelCase/toPascalCase Mar 26, 2026
@pyramation pyramation merged commit b0dba5f into main Mar 26, 2026
36 checks passed
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.

1 participant