npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

case-converters

v4.2.4

Published

A modern TypeScript utility to convert strings and object keys between various case styles like camelCase, snake_case, PascalCase, kebab-case, spongeCase, and more.

Readme

case-converters

npm version npm downloads license

⚠️ Not to be confused with the deprecated case-converter.
case-converters is a modern, actively maintained package with full TypeScript support, robust object key transformation, and support for 15+ string casing styles.


case-converters is a lightweight yet powerful utility to convert strings and object keys into a wide range of naming conventions — like camelCase, PascalCase, snake_case, kebab-case, Train-Case, SpongeCase, and more.

  • ✔ Supports string and object key transformation
  • ✔ Works with arrays of objects
  • ✔ ESM & CommonJS compatible
  • ✔ 100% written in TypeScript

📚 Table of Contents


📦 Supported Case Styles

  • camel, pascal, snake, kebab, constant, dot, path, title, sentence, capital, train
  • sponge, swap, upper, lower, no, localeUpper, localeLower, lowerFirst, upperFirst
  • ... and more!

🔧 Installation

npm install case-converters

## 🚀 Quick Usage

### 🔹 String Case Conversion

#### CommonJS

```js
const { camel, upper } = require("case-converters");

console.log(camel("test string")); // testString
console.log(upper("test string")); // TEST STRING

ES Modules / TypeScript

import { Case } from "case-converters";

console.log(Case.camel("test string")); // testString
console.log(Case.upper("test string")); // TEST STRING

🔹 Object Key Case Conversion

Convert keys of an object (or array of objects):

const { objToCamel, objToPascal } = require("case-converters");

const input = [{ user_name: "Alice" }, { user_name: "Bob" }];

console.log(objToCamel(input));
console.log(objToPascal(input));

📘 API Reference

🔹 String Methods

You can use either the Case class or direct function imports:

import {
  camel,
  capital,
  constant,
  dot,
  no,
  pascal,
  path,
  sentence,
  snake,
  train,
  kebab,
  sponge,
  swap,
  title,
  upper,
  localeUpper,
  lower,
  localeLower,
  lowerFirst,
  upperFirst,
  isUpper,
  isLower,
} from "case-converters";

const str = "test string";

camel(str);
pascal(str);
snake(str);
// ...

Or use the class style:

import { Case } from "case-converters";

Case.kebab(str);
Case.title(str);

🔹 Object Key Methods

Available functions:

  • objToCamel(obj)
  • objToPascal(obj)
  • objToSnake(obj)
  • objToKebab(obj)
  • objToConstant(obj)
  • objToCapital(obj)
  • objToTrain(obj)
  • objToTitle(obj)
  • objToSentence(obj)
  • objToDot(obj)
  • objToPath(obj)
  • objToNot(obj)
  • objToSponge(obj)
  • objToSwap(obj)
  • objToUpper(obj)
  • objToLower(obj)

Example:

const obj = { first_name: "John", last_name: "Doe" };
console.log(objToCamel(obj));

🌐 Live Demo

Try it online:
👉 StackBlitz Live Demo


🔗 Links


📄 License

ISC © Chirag Chauhan


📬 Contact

For questions, suggestions, or collaborations: