A utility for transforming string cases in javascript.
JavaScript built-in methods for transforming string cases are limited to .toLowerCase()
and .toUpperCase()
.
- Install via a package manager
npm
oryarn
npm i alter-case
or
yarn add alter-case
- Install via CDN
<!-- Minified Version -->
<script src="https://unpkg.com/alter-case@0.1.0/dist/index.min.js"></script>
<!-- Raw -->
<script src="https://unpkg.com/alter-case@0.1.0/dist/index.umd.js"></script>
alter-case
come bundled with these functions:
import { camelCase } from "alter-case";
camelCase("sample_text"); // sampleText
import { capitalCase } from "alter-case";
capitalCase("sample_text"); // Sample Text
import { constantCase } from "alter-case";
constantCase("sample text"); // SAMPLE_TEXT
import { kebabCase } from "alter-case";
kebabCase("sample text"); // sample-text
import { pascalCase } from "alter-case";
pascalCase("sample text"); // SampleText
import { snakeCase } from "alter-case";
snakeCase("sample text"); // sample_text
import { lowerCase } from "alter-case";
// similar to javascript .toLowerCase()
lowerCase("Sample Text"); // sample text
import { upperCase } from "alter-case";
// similar to javascript .toUpperCase()
upperCase("sample text"); // SAMPLE TEXT
MIT