
Security News
MCP Steering Committee Launches Official MCP Registry in Preview
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.
easy-string-case
Advanced tools
TypeScript library to convert strings between different case formats.
TypeScript library to convert strings between different case formats.
camelCase
, PascalCase
, snake_case
, kebab-case
, dot.case
, path/case
, SCREAMING_SNAKE_CASE
, COBOL-CASE
, Title Case
, Sentence case
, UpperCamelCase
.npm install easy-string-case
import { StringCase } from 'easy-string-case';
StringCase.toCamelCase('hello world'); // 'helloWorld'
StringCase.toPascalCase('foo_bar-baz'); // 'FooBarBaz'
StringCase.toKebabCase('HelloWorld'); // 'hello-world'
StringCase.toSnakeCase('foo-bar baz'); // 'foo_bar_baz'
StringCase.toDotCase('snake_case-example'); // 'snake.case.example'
StringCase.toPathCase('FooBarBaz'); // 'foo/bar/baz'
StringCase.toScreamingSnakeCase('helloWorld'); // 'HELLO_WORLD'
StringCase.toCobolCase('snake_case'); // 'SNAKE-CASE'
StringCase.toTitleCase('mixedCASE input'); // 'MixedCASE Input'
StringCase.toSentenceCase('THIS_IS_A_TEST'); // 'This is a test'
StringCase.toUpperCamelCase('hello world'); // 'HelloWorld'
All methods are static and take a single argument: the string to convert.
StringCase.toCamelCase(str: string): string
Converts to camelCase. Example: "hello world"
→ "helloWorld"
StringCase.toPascalCase(str: string): string
Converts to PascalCase (UpperCamelCase). Example: "foo_bar-baz"
→ "FooBarBaz"
StringCase.toKebabCase(str: string): string
Converts to kebab-case. Example: "HelloWorld"
→ "hello-world"
StringCase.toSnakeCase(str: string): string
Converts to snake_case. Example: "foo-bar baz"
→ "foo_bar_baz"
StringCase.toDotCase(str: string): string
Converts to dot.case. Example: "snake_case-example"
→ "snake.case.example"
StringCase.toPathCase(str: string): string
Converts to path/case. Example: "FooBarBaz"
→ "foo/bar/baz"
StringCase.toScreamingSnakeCase(str: string): string
Converts to SCREAMING_SNAKE_CASE. Example: "helloWorld"
→ "HELLO_WORLD"
StringCase.toCobolCase(str: string): string
Converts to COBOL-CASE. Example: "snake_case"
→ "SNAKE-CASE"
StringCase.toTitleCase(str: string): string
Converts to Title Case. Example: "mixedCASE input"
→ "MixedCASE Input"
StringCase.toSentenceCase(str: string): string
Converts to Sentence case. Example: "THIS_IS_A_TEST"
→ "This is a test"
StringCase.toUpperCamelCase(str: string): string
Converts to UpperCamelCase (PascalCase). Example: "hello world"
→ "HelloWorld"
StringCase.toCamelCase('XML_http-request'); // 'xmlHttpRequest'
StringCase.toPascalCase('foo-bar_baz qux'); // 'FooBarBazQux'
StringCase.toKebabCase('some Text@ with spêcial#char'); // 'some-text-with-special-char'
StringCase.toSnakeCase(' hello world '); // 'hello_world'
StringCase.toDotCase('foo_bar.baz-qux'); // 'foo.bar.baz.qux'
StringCase.toPathCase('foo_bar.baz-qux'); // 'foo/bar/baz/qux'
StringCase.toScreamingSnakeCase('some Text@ with spêcial#char'); // 'SOME_TEXT_WITH_SPECIAL_CHAR'
StringCase.toCobolCase('foo-bar.baz_qux'); // 'FOO-BAR-BAZ-QUX'
StringCase.toTitleCase('foo-bar.baz_qux'); // 'Foo Bar Baz Qux'
StringCase.toSentenceCase('foo-bar.baz_qux'); // 'Foo bar baz qux'
StringCase.toUpperCamelCase('foo-bar.baz_qux'); // 'FooBarBazQux'
The main logic is in two classes:
No external dependencies are used. All code is pure and portable TypeScript.
The library includes unit tests with Jest for all methods and relevant cases. You can run them with:
npm run test
MIT
FAQs
TypeScript library to convert strings between different case formats.
We found that easy-string-case demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.
Product
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
Research
/Security News
npm author Qix’s account was compromised, with malicious versions of popular packages like chalk-template, color-convert, and strip-ansi published.