@jeash/case
A lightweight package for converting string cases.
Installation
Install @jeash/case
using npm:
npm install @jeash/case
Usage
Here is an example of how to use @jeash/case:
import { titleCase, kebabCase } from '@jeash/case';
const myTitleCaseString = titleCase('hello world');
const myKebabCaseString = kebabCase('hello world');
Alternatively, you can import the methods individually:
import titleCase from '@jeash/case/titleCase';
import kebabCase from '@jeash/case/kebabCase';
const myTitleCaseString = titleCase('hello world');
const myKebabCaseString = kebabCase('hello world');
API
@jeash/case
exports the following methods:
alternatingCase
alternatingCase('Hello World') // => HeLlO WoRlD
alternatingInverseCase
alternatingInverseCase('Hello World') // => hElLo wOrLd
inverseCase
inverseCase('Hello World') // => hELLO wORLD
jejeCase
jejeCase('Hello World') // => HElLoH WOrlD
kebabCase
kebabCase('Hello World') // => hello-world
sentenceCase
sentenceCase('Hello World') // => Hello world
snakeCase
snakeCase('Hello World') // => hello_world
titleCase
titleCase('Hello World') // => Hello World
wideCase
wideCase('Hello World') // => H e l l o W o r l d
wideLowerCase
wideLowerCase('Hello World') // => h e l l o w o r l d
wideUpperCase
wideUpperCase('Hello World') // => H E L L O W O R L D
Contributing
Contributions to @jeash/case
are welcome. If you have any bug fixes, improvements or feature requests, please submit a pull request on GitHub.