Convert text to alternating uppercase and lowercase letters
npm install @jstiehl/alternating-caseConvert text to alternating uppercase and lowercase letters.
``bash`
npm install @jstiehl/alternating-caseor using yarn
yarn add @jstiehl/alternating-case
---
`ts
import { alternatingCase } from "@jstiehl/alternating-case";
console.log(alternatingCase("hello world"));
// Output: HeLlO WoRlD
console.log(alternatingCase("hello world", { start: "lower" }));
// Output: hElLo wOrLd
`
---
| Option | Type | Default | Description | |
| ------- | -------- | -------- | ----------- | -------------------------------------------------------------------------- |
| start | "upper" | "lower" | "upper" | Choose whether the alternating sequence starts with uppercase or lowercase |
- input: The string to convert
- Returns: A string with alternating letter case
---
- Fully typed for TypeScript
- Import types automatically from:
`ts``
import { alternatingCase } from "@jstiehl/alternating-case";
---
MIT © James Stiehl