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

@lacspace/case

v1.1.0

Published

Convert strings between cases — camelCase, PascalCase, snake_case, kebab-case, CONSTANT_CASE, Title Case, Sentence case, Header-Case & more. Unicode-aware splitting, acronym registry, and is<Case> detectors. Zero-dependency, isomorphic.

Readme

@lacspace/case

Convert strings between cases — camelCase, PascalCase, snake_case, kebab-case, CONSTANT_CASE, Title Case & more.

npm version minzipped types license

The string-case toolkit — correct on the tricky inputs (acronyms like XMLHttpRequest, numbers like v2, mixed separators, accented unicode). One tiny, typed, dependency-free package instead of a grab-bag of one-function modules.

  • 🐫 camelCase · pascalCase — foo_bar → fooBar / FooBar
  • 🐍 snakeCase · kebabCase · constantCase — FOO_BAR, foo-bar, foo_bar
  • 📝 titleCase · sentenceCase · capitalize · dotCase · pathCase
  • 🚂 headerCase / trainCase · capitalCase · noCase
  • 🎛️ changeCase(str, name) — pick the case at runtime; words(str) / splitWords(str) are the splitters
  • 🔎 isCamelCase, isSnakeCase, … — detect the case (and prove a conversion is a no-op)
  • 🌍 Zero dependencies · isomorphic · fully typed

New in 1.1.0 — three more cases (headerCase/trainCase, capitalCase, noCase), a unicode-aware splitWords() that keeps digit groups (v2Point → ["v2","Point"]) and splits acronyms (APIResponse → ["API","Response"]), an opt-in acronym registry (registerAcronyms("API","URL") or per-call { acronyms }) to keep known acronyms upper-cased, and is<Case>() detectors. Fully backward compatible — no existing output changed.

Install

npm install @lacspace/case      # or pnpm add / yarn add / bun add

Use

import { camelCase, snakeCase, kebabCase, constantCase, titleCase, changeCase } from "@lacspace/case";

camelCase("foo_bar-baz");        // "fooBarBaz"
snakeCase("fooBarBaz");          // "foo_bar_baz"
kebabCase("XMLHttpRequest");     // "xml-http-request"
constantCase("fooBar");          // "FOO_BAR"
titleCase("hello_world");        // "Hello World"

changeCase("fooBar", "kebab");   // "foo-bar"   ← pick the case at runtime
import {
  headerCase, capitalCase, noCase, splitWords,
  registerAcronyms, isSnakeCase,
} from "@lacspace/case";

headerCase("foo bar");           // "Foo-Bar"   (Train-Case)
capitalCase("foo_bar");          // "Foo Bar"
noCase("fooBar");                // "foo bar"

splitWords("APIResponse");       // ["API", "Response"]
splitWords("v2Point");           // ["v2", "Point"]  (keeps digit groups)
splitWords("v2Point", { splitOnNumbers: true }); // ["v", "2", "Point"]

// Preserve acronyms (opt-in — defaults unchanged)
pascalCase("apiResponse", { acronyms: ["API"] }); // "APIResponse"
registerAcronyms("API", "URL", "ID");             // or register globally
pascalCase("apiUrl");                             // "APIURL"

isSnakeCase("foo_bar");          // true — already correct, conversion is a no-op

API

| Function | Example | | --- | --- | | camelCase | fooBar | | pascalCase | FooBar | | snakeCase | foo_bar | | kebabCase | foo-bar | | constantCase | FOO_BAR | | dotCase / pathCase | foo.bar / foo/bar | | titleCase / sentenceCase | Foo Bar / Foo bar | | headerCase / trainCase | Foo-Bar | | capitalCase / noCase | Foo Bar / foo bar | | capitalize | Foo | | words(str) | ["foo","bar"] — the splitter behind them all | | splitWords(str, opts?) | unicode-aware splitter; keeps digit groups, splitOnNumbers option | | changeCase(str, name) | runtime case by name (camel,…,header,train,capital,no) | | isCase(str, name) / isCamelCase(str) … | detect whether a string is already in a case | | registerAcronyms(...) / getAcronyms() / clearAcronyms() | manage the global acronym registry |

words() splits on spaces, _ - . /, camelCase boundaries, acronym boundaries and letter/number boundaries — so every conversion is consistent. splitWords() is a unicode-aware alternative that understands accented letters and keeps digit groups (v2) together by default. The acronym-aware converters (camelCase, pascalCase, titleCase, sentenceCase, capitalCase, headerCase) accept an optional { acronyms } and honour the global registry — off by default, so existing output is unchanged.

Licensing

This package is free under the Lacspace Free Licence — permissive freedoms. Use it in personal and commercial projects at no cost; just keep the notice.

Not every Lacspace package is free. We also offer Commercial, Client-specific and Private packages under separate terms — see the Lacspace Licence Centre.


The Lacspace Developer Platform

@lacspace/case is part of 80+ zero-dependency, isomorphic TypeScript packages — one standard library for the modern web. Explore the ecosystem:

  • 📦 This package, documented — https://developer.lacspace.com/packages/case
  • 🗂️ All 80+ packages — https://developer.lacspace.com/packages
  • 🧭 Developer handbook — guides & runnable recipes — https://developer.lacspace.com/handbook
  • 🧪 Live playground — run any package in your browser — https://developer.lacspace.com/playground
  • 🖥️ Finished app templates — https://templates.lacspace.com
  • 🚀 Scaffold a full app — npm create lacspace-app@latest

Free under the Lacspace Free Licence — a permissive, free-to-use licence.