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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@art-suite/art-core-ts-string-case

v0.1.17

Published

A TypeScript string library for converting strings to different 'code word' cases: camelCase, snake_case, kebab-case, PascalCase, etc.

Readme

@art-suite/art-core-ts-string-case

Effortless, lossless conversion between all common string case formats in programming.

Why This Module?

The Why: There are several common ways to represent words without spaces in programming—camelCase, snake_case, dash-case, and more. Converting between them is a frequent need, but handling edge cases (especially acronyms) is tricky and error-prone. There is no clear standard for how to represent acronyms as "code words," and most libraries lose information when converting between formats.

The How: This library makes one key assumption: acronyms are treated as words. For example, "HTML" is treated as the word "Html" for the purpose of code words. This enables lossless, round-trip conversion between all supported formats—so you can always convert back and forth without losing word boundaries or acronym information.

The What: A comprehensive set of functions for converting between camelCase, PascalCase, snake_case, UPPER_SNAKE_CASE, dash-case, Capitalized-Dash-Case, and more, all with robust handling of acronyms.

Example Installation and Use (Required)

Install with npm:

npm install @art-suite/art-core-ts-string-case

Basic usage:

import {
  getCodeWords,
  lowerCamelCase,
  upperCamelCase,
  snakeCase,
  upperSnakeCase,
  dashCase,
  capitalizedDashCase,
  pascalCase,
  kebabCase,
  constantCase,
  camelCase,
} from "@art-suite/art-core-ts-string-case";

getCodeWords("toHTML"); // ["to", "Html"]
lowerCamelCase("to HTML"); // "toHtml"
upperCamelCase("to HTML"); // "ToHtml"
snakeCase("to HTML"); // "to_html"
upperSnakeCase("to HTML"); // "TO_HTML"
dashCase("to HTML"); // "to-html"
capitalizedDashCase("to HTML"); // "To-Html"

// Aliases
pascalCase("to HTML"); // "ToHtml"
kebabCase("to HTML"); // "to-html"
constantCase("to HTML"); // "TO_HTML"
camelCase("to HTML"); // "toHtml"

// All converters accept an optional second parameter: the joiner string
upperCamelCase("to HTML", " "); // "To Html"
snakeCase("to HTML", "--"); // "to--html"

Functional Overview

Code Word Extraction

  • getCodeWords(str) — Extracts an array of code words from any string, treating acronyms as words (e.g., "toHTML" → ["to", "Html"]).

Case Conversion Functions

All converters accept an optional second parameter, joiner, which is the string inserted between each word (default varies by converter).

  • lowerCamelCase(str, joiner?) — Converts to lowerCamelCase.
  • upperCamelCase(str, joiner?) — Converts to UpperCamelCase (PascalCase).
  • snakeCase(str, joiner?) — Converts to snake_case.
  • upperSnakeCase(str, joiner?) — Converts to UPPER_SNAKE_CASE.
  • dashCase(str, joiner?) — Converts to dash-case.
  • capitalizedDashCase(str, joiner?) — Converts to Capitalized-Dash-Case.
  • pascalCase(str, joiner?) — Alias for upperCamelCase.
  • kebabCase(str, joiner?) — Alias for dashCase.
  • constantCase(str, joiner?) — Alias for upperSnakeCase.
  • camelCase(str, joiner?) — Alias for lowerCamelCase.

Word Case Utilities

  • lowerCase(str)