Gathering detailed insights and metrics for case-anything
Gathering detailed insights and metrics for case-anything
Gathering detailed insights and metrics for case-anything
Gathering detailed insights and metrics for case-anything
@vinsurs/case-anything
An opinionated case-anything lib based on case-anything
conversikit
convert anything
tlsupportfunctions
This package includes frequently used functions used by the Transformation Layer. Every aspect of the package can function on its own though the use case is highly specific and it is not recommended to use this package for anything but the project it was
camelCase, kebab-case, PascalCase... a simple integration with nano package size. (SMALL footprint!)
npm install case-anything
Typescript
Module System
Min. Node Version
Node Version
NPM Version
99.9
Supply Chain
100
Quality
76.9
Maintenance
100
Vulnerability
100
License
TypeScript (99.85%)
JavaScript (0.15%)
Total Downloads
79,993,359
Last Day
33,535
Last Week
886,174
Last Month
3,698,780
Last Year
35,680,005
MIT License
107 Stars
159 Commits
3 Forks
2 Watchers
5 Branches
1 Contributors
Updated on Jun 13, 2025
Latest Version
3.1.2
Package Id
case-anything@3.1.2
Unpacked Size
32.34 kB
Size
7.39 kB
File Count
9
NPM Version
10.2.4
Node Version
20.11.1
Published on
Feb 19, 2025
Cumulative downloads
Total Downloads
Last Day
-10.1%
33,535
Compared to previous day
Last Week
-6.4%
886,174
Compared to previous week
Last Month
4.9%
3,698,780
Compared to previous month
Last Year
-2.4%
35,680,005
Compared to previous year
5
1# npm 2npm i case-anything 3 4# deno 5deno add jsr:@mesqueeb/case-anything 6 7# jsr (use any of npx, yarn dlx, pnpm dlx, or bunx) 8npx jsr add @mesqueeb/case-anything
14 case changing functions: camelCase, kebab-case, PascalCase and more...
A simple integration with nano package size. (SMALL footprint!)
I created this package because most other packages that do simple case changing are so big...
Some features I focused on: |
Case anything is used in... |
case-anything supports tree-shaking and is side-effect free!
1// just import the functions you need like so: 2import { camelCase, kebabCase } from 'case-anything'
case-anything has different behaviour if the string you pass has spaces or not.
Name | Input example | Output example |
---|---|---|
🐪 camelCase | camelCase('$catDog') | catDog |
🐫 PascalCase UpperCamelCase | pascalCase('$catDog') upperCamelCase('$catDog') | CatDog |
🥙 kebab-case | kebabCase('$catDog') | cat-dog |
🐍 snake_case | snakeCase('$catDog') | cat_dog |
📣 CONSTANT_CASE | constantCase('$catDog') | CAT_DOG |
🚂 Train-Case | trainCase('$catDog') | Cat-Dog |
🕊 Ada_Case | adaCase('$catDog') | Cat_Dog |
👔 COBOL-CASE | cobolCase('$catDog') | CAT-DOG |
📍 Dot.notation | dotNotation('$catDog') | cat.Dog |
📂 Path/case | pathCase('$catDog') | $cat/Dog |
🛰 Space case | spaceCase('$catDog') | $cat Dog |
🏛 Capital Case | capitalCase('$catDog') | $Cat Dog |
🔡 lower case | lowerCase('$catDog') | $cat dog |
🔠 UPPER CASE | upperCase('$catDog') | $CAT DOG |
You can see that most functions by default remove special characters, and some functions keep special characters.
functions that remove special characters* | functions that keep special characters* |
---|---|
|
|
*You can control wether or not to keep or remove special characters like so:
1// default: 2camelCase('$catDog') === 'catDog' 3// force keeping special characters: 4camelCase('$catDog', { keepSpecialCharacters: true }) === '$catDog' 5 6// default: 7pathCase('$catDog') === '$cat/Dog' 8// force removing special characters: 9pathCase('$catDog', { keepSpecialCharacters: false }) === 'cat/Dog'
These cases do not change the casing of the words:
1// default: 2dotNotation('$catDog') === 'cat.Dog' 3// force lower case: 4dotNotation('$catDog').toLowerCase() === 'cat.dog'
As soon as there is a space in the target string, it will regard the input as a sentence and only split each part at the spaces.
Name | Input example | Output example |
---|---|---|
🐪 camelCase | camelCase("I'm O.K.!") | imOk |
🐫 PascalCase UpperCamelCase | pascalCase("I'm O.K.!") upperCamelCase("I'm O.K.!") | ImOk |
🥙 kebab-case | kebabCase("I'm O.K.!") | im-ok |
🐍 snake_case | snakeCase("I'm O.K.!") | im_ok |
📣 CONSTANT_CASE | constantCase("I'm O.K.!") | IM_OK |
🚂 Train-Case | trainCase("I'm O.K.!") | Im-Ok |
🕊 Ada_Case | adaCase("I'm O.K.!") | Im_Ok |
👔 COBOL-CASE | cobolCase("I'm O.K.!") | IM-OK |
📍 Dot.notation | dotNotation("I'm O.K.!") | Im.OK |
📂 Path/case | pathCase("I'm O.K.!") | I'm/O.K.! |
🛰 Space case | spaceCase("I'm O.K.!") | I'm O.K.! |
🏛 Capital Case | capitalCase("I'm O.K.!") | I'm O.k.! |
🔡 lower case | lowerCase("I'm O.K.!") | i'm o.k.! |
🔠 UPPER CASE | upperCase("I'm O.K.!") | I'M O.K.! |
Also note, that multiple sequential spaces are treated as one space.
Instead of removing all special characters, you can opt to keep some special characters.
In the example below we see:
$cat-dog
$CatDog
1pascalCase('$cat-dog', { keepSpecialCharacters: false })
2// CatDog → not what we want
3
4pascalCase('$cat-dog', { keepSpecialCharacters: true })
5// $Cat-Dog → not what we want
6
7pascalCase('$cat-dog', { keep: ['$'] })
8// $CatDog → desired output
I have extended regular alphabet with the most common Latin-1 Supplement special characters.
The coolest thing about this library is that it will "convert" special characters into regular alphabet for the cases used as variable names! 😎
1// CONVERTS special characters: 2camelCase('Çâfé Ågård') === 'cafeAgard' 3pascalCase('Çâfé Ågård') === 'CafeAgard' 4kebabCase('Çâfé Ågård') === 'cafe-agard' 5snakeCase('Çâfé Ågård') === 'cafe_agard' 6constantCase('Çâfé Ågård') === 'CAFE_AGARD' 7trainCase('Çâfé Ågård') === 'Cafe-Agard' 8adaCase('Çâfé Ågård') === 'Cafe_Agard' 9cobolCase('Çâfé Ågård') === 'CAFE-AGARD' 10dotNotation('Çâfé Ågård') === 'Cafe.Agard' 11 12// DOES NOT convert special characters: 13spaceCase('Çâfé Ågård') === 'Çâfé Ågård' 14pathCase('Çâfé Ågård') === 'Çâfé/Ågård' 15lowerCase('Çâfé Ågård') === 'çâfé ågård' 16upperCase('Çâfé Ågård') === 'ÇÂFÉ ÅGÅRD' 17capitalCase('Çâfé Ågård') === 'Çâfé Ågård'
I have made sure there is great documentation available on hover!
With Better Touch Tool you can set up keyboard shortcuts to convert selected text with JavaScript. This repo provides an easy to install preset that has shortcuts for pascal, kebab and camel case! (thanks to @AndrewKoch) It even supports multi-cursors in VSCode!
Here is an example triggering keyboard shortcuts to convert the selected text to PascalCase; kebab-case; camelCase:
You can download the BTT preset from the source code: case-anything.bttpreset.
We'll compare this package with blakeembrey/change-case, a very famous package on npm.
case-anything | change-case | |
---|---|---|
camelCase | 1.1K (572) | 27.2K (6K) |
pascalCase | 1.1K (561) | 27.4K (6.1K) |
kebabCase | 1.1K (541) | 26.8K (5.9K) |
snakeCase | 1.1K (540) | 26.8K (5.9K) |
constantCase | 1.1K (540) | 27.2K (6K) |
pathCase | 1K (530) | 26.8K (5.9K) |
What keeps my package small, is that literally just uses a regex to separate "words".
1// the source code is similar to: 2export function splitOnSpecialChars(string: string): any[] { 3 return string.match(/^[a-z]+|[A-Z][a-z]+|[a-z]+|[0-9]+|[A-Z]+(?![a-z])/g) 4}
The actual regex used is a little bit more comprehensive and can be found here.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
7 existing vulnerabilities detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-06-16
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More