A lightweight JavaScript/TypeScript library (v1.1.2, stable) for converting strings and object keys between camelCase, snake_case, PascalCase, and kebab-case. Provides bidirectional converters for all 4 cases via a single default export with method chaining. Supports type-safe conversions on Records using generics. Ships TypeScript types. Differentiator: simple API, full matrix of conversions (12 methods), and generic typing for object key transforms. No dependencies, works in Node and browser.
npm install case-formatterNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates string and object key conversion between snake_case and camelCase, plus PascalCase to kebab-case, using the library's default export.
Use generics: caseFormatter.snakeToCamel<YourType>(obj)
Use a different library like change-case for more cases.
Manually apply conversion to nested structures or use a library like humps for recursive conversion.
Use `import caseFormatter from 'case-formatter'`
Change to: import caseFormatter from 'case-formatter';
Use default import: import caseFormatter from 'case-formatter';
Pass a generic type parameter: caseFormatter.snakeToCamel<{myString: number}>({my_string: 1})No dependency data recorded yet.