Install using npm or yarn:
npm i scule
# or
yarn add scule
Import:
// CommonJS
const { pascalCase } = require('scule')
// ESM
import { pascalCase } from 'scule'
Notice: You may need to transpile package for legacy environments
Splits string and joins by PascalCase convention (foo-bar
=> FooBar
)
Remarks:
- If an uppercase letter is followed by other uppercase letters (like
FooBAR
), they are preserved
Splits string and joins by camelCase convention (foo-bar
=> fooBar
)
Splits string and joins by kebab-case convention (fooBar
=> foo-bar
)
Remarks:
- It does not preserve case
Splits string and joins by snake_case convention (foo-bar
=> foo_bar
)
Converts first character to upper case
Converts first character to lower case
- Splits string by the splitters provided (default:
['-', '_', '/', '.]
) - Splits when case changes from lower to upper or upper to lower
- Ignores numbers for case changes
- Case is preserved in returned value
- Is an irreversible function since splitters are omitted