New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

capstring

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

capstring

CaPiTaLiZe StRiNgS in 24+ ways!

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

capstring npm version npm downloads CI Open Source Love Semver License LinkedIn

capstring

CaPiTaLiZe StRiNgS in 29 ways!

A lightweight, zero-dependency library for text capitalization and transformation. Perfect for formatting strings for code, URLs, display, or fun!

Features

  • 29 transformation styles - More than any other library!
  • Zero dependencies - Lightweight and fast
  • ESM native - Modern JavaScript modules
  • 98% test coverage - Thoroughly tested

Installation

npm install capstring

Quick Start

import capstring from 'capstring';

capstring('hello world', 'title');     // 'Hello World'
capstring('hello world', 'camel');     // 'helloWorld'
capstring('hello world', 'kebab');     // 'hello-world'
capstring('hello world', 'constant');  // 'HELLO_WORLD'
capstring('hello world', 'leet');      // 'h3££0 w0r£d'
capstring('hello world', 'hashtag');   // '#HelloWorld'

All 29 Styles

Case Styles

StyleInputOutput
sameHello WorldHello World
noneHello World(empty)
properHello WorldHello World
titlehello worldHello World
sentencehello worldHello world
upperhello worldHELLO WORLD
lowerHELLO WORLDhello world
swapHello WorldhELLO wORLD

Code Styles

StyleInputOutput
camelhello worldhelloWorld
pascalhello worldHelloWorld
snakehello worldhello_world
kebabhello worldhello-world
slughello worldhello-world
constanthello worldHELLO_WORLD
pythonhello worldHELLO_WORLD
dothello worldhello.world
pathhello worldhello/world
trainhello worldHello-World

Fun Styles

StyleInputOutput
leethello worldh3££0 w0r£d
reversehello worlddlrow olleh
spongehello worldHeLlO WoRlD
mockhello worldhElLo wOrLd
alternatehello worldhElLo WoRlD
crazyhello world(deterministic random)
randomhello world(random case)

New Styles

StyleInputOutput
hashtaghello world#HelloWorld
acronymas soon as possibleASAP
rot13hellouryyb
fliphelloollǝɥ

API

capstring(str, style)

Transform a string to the specified style.

import capstring from 'capstring';

capstring('hello world', 'title');  // 'Hello World'
capstring('hello world');           // 'hello world' (default: same)
capstring(123);                     // false (invalid input)

getStyles()

Get an array of all supported style names.

import { getStyles } from 'capstring';

getStyles();  // ['same', 'none', 'proper', 'title', ...]

isValidStyle(style)

Check if a style is supported.

import { isValidStyle } from 'capstring';

isValidStyle('kebab');    // true
isValidStyle('invalid');  // false

STYLES

Frozen array of all style names.

import { STYLES } from 'capstring';

STYLES.length;  // 29

REST API

Looking for an API? Check out cAPIta - a full REST API powered by capstring!

curl https://your-api.com/title/hello%20world
# {"input":"hello world","output":"Hello World","cap":"title"}

Development

npm install        # Install dependencies
npm test           # Run tests
npm run lint       # Run linter
npm run test:coverage  # Test with coverage

Contributing

Please read CONTRIBUTING.md for details on the code of conduct and the process for submitting pull requests.

Versioning

This project uses Semantic Versioning 2.0.

Requirements

  • Node.js 18+
  • ES modules (import/export)

License

MIT - Copyright 2016-2026 Brian Funk

Keywords

cap

FAQs

Package last updated on 08 Feb 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts