๐ฎ Magical utility for string casing
# nyxi
nyxi magicase
# pnpm
pnpm add magicase
# npm
npm i magicase
# yarn
yarn add magicase
// CommonJS
const { pascalCase } = require('magicase')
// ESM
import { pascalCase } from 'magicase'
Notice: You may need to transpile the package for older environments.
Splits the string and joins it in PascalCase convention (foo-bar โก๏ธ FooBar)
Remarks:
If an uppercase letter is followed by other uppercase letters (e.g., FooBAR), it is preserved.
Splits the string and joins it in camelCase convention (foo-bar โก๏ธ fooBar)
Splits the string and joins it in kebab-case convention (fooBar โก๏ธ foo-bar)
Remarks:
- It does not preserve case
Splits the string and joins it in snake_case convention (foo-bar โก๏ธ foo_bar)
Converts the first character to uppercase.
Converts the first character to lowercase.
- ๐งฉ Splits the string by the provided splitters (default: ['-', '_', '/', '.']).
- ๐ Splits when there is a case change from lowercase to uppercase or uppercase to lowercase.
- ๐ข Ignores numbers for case changes.
- ๐ Case is preserved in the returned value.
- โ This is an irreversible function since the splitters are omitted.
- ๐ Clone this repository
- ๐ฅ Install latest LTS version of Node.js
- ๐งฉ Enable Corepack using corepack enable
- ๐ฆ Install dependencies using pnpm install
โถ๏ธ Run interactive tests using pnpm dev
MIT - Made with ๐