text-case
Convert strings between camelCase, PascalCase, snake_case, kebab-case, and 17 other text case formats with a zero-dependency TypeScript monorepo.
Repository Health
Technical Analysis
Text Case is a TypeScript monorepo of 21 independently published packages, each converting strings to a single case format—camelCase, PascalCase, snake_case, kebab-case, CONSTANT_CASE, dot.case, path/case, Title Case, Sentence case, and more—plus two boolean validators, isUpperCase and isLowerCase. Installing the umbrella text-case package pulls in every converter, or consumers can install just the individual text-camel-case, text-kebab-case, etc. packages they actually need.
Under the hood every transformer builds on a shared no-case tokenizer that splits input on Unicode-aware word boundaries (camelCase humps, non-letter separators) before re-joining tokens with a per-format transform function. The lower-case primitive includes locale-specific special-casing tables for Turkish, Azerbaijani, and Lithuanian, so case conversion doesn’t silently corrupt dotted/dotless I characters in those locales—a detail most case-conversion libraries skip.
What You Get
- 21 independently published npm packages (one per case format) plus the text-case umbrella package that re-exports all of them
- Full TypeScript definitions with a shared Options interface for custom split/strip regexes and per-word transforms
- Locale-aware casing rules for Turkish, Azerbaijani, and Lithuanian dotless-I handling in text-lower-case
- Two boolean validators, isUpperCase and isLowerCase, for input-format checks
- Jest test suites per package with a 100%-branch-coverage threshold enforced in the Jest config
Common Use Cases
- Converting database snake_case columns into camelCase object keys for a JS/TS API layer
- Normalizing user-supplied strings into kebab-case for URL slugs or CSS class names
- Generating CONSTANT_CASE environment-variable names from arbitrary config keys
- Turning free-text titles into Title Case or Sentence case for display in a UI
- Building code-generation tooling that needs consistent PascalCase class names or camelCase properties from any input casing
Under The Hood
Architecture
The repo is a pnpm/Lerna monorepo of 21 single-responsibility packages under packages/. A shared text-no-case package owns the core tokenizer (word-splitting via Unicode-aware regexes, character stripping, and a pluggable transform callback); format-specific packages like text-pascal-case and text-camel-case layer a transform function on top of it, and further converters (text-camel-case, text-kebab-case, etc.) compose on top of those. The umbrella text-case package (packages/text-case) simply re-exports every sibling package’s public API via export * from "...", so consumers choose between one dependency or many tiny ones. This layering keeps each package’s own logic minimal while letting the umbrella package aggregate for convenience.
Tech Stack TypeScript with strict mode across every package (tsconfig.base.json), dual-target builds (CommonJS via tsc plus an ES2015 build via tsconfig.es2015.json) for both Node and bundler consumers. Jest with ts-jest runs the test suites, ESLint’s flat config (eslint.config.js) with @typescript-eslint enforces linting, Prettier plus husky/lint-staged run on pre-commit and pre-push, Lerna handles independent versioning and publishing across the workspace, and size-limit enforces a sub-kilobyte bundle budget per package. Every package has zero runtime dependencies outside its own sibling packages.
Code Quality Each package carries an extensive .spec.ts test file (500+ lines in the sampled camel-case and no-case packages) covering standard conversions, Unicode edge cases, and locale-specific behavior, with Jest’s coverageThreshold requiring 100% branches/functions/lines/statements. Source files are documented with JSDoc comments including @example blocks on every exported function, and functions guard explicitly against null/undefined input rather than throwing. No dedicated CI workflow file was found in .github/workflows in the cloned snapshot, though a legacy .travis.yml exists and README badges reference a GitHub Actions CI pipeline.
What Makes It Unique
Case-conversion utilities are a well-trodden problem (lodash, change-case, and others solve the same need), so this isn’t a novel category. What differentiates Text Case is the combination of extremely fine-grained, independently installable packages for tree-shaking down to a handful of bytes, and locale-aware lower-casing that correctly handles Turkish/Azerbaijani/Lithuanian dotless-I rules—an i18n correctness detail that naive .toLowerCase()-based converters commonly get wrong.
Used by 2 apps in this directory
AnythingLLM
Developer Tools · Automation · AI Assistants
The all-in-one AI platform for private document chat, no-code agents, and local LLMs with zero setup friction.
DefGuard
Security · Networking · Authentication
Self-hosted secure remote access that unifies WireGuard VPN, identity management, and connection-level MFA in one open-source platform.