https://github.com/stein197/js-caser
String case converter and parser
https://github.com/stein197/js-caser
camelcase case casing coverter
Last synced: about 1 month ago
JSON representation
String case converter and parser
- Host: GitHub
- URL: https://github.com/stein197/js-caser
- Owner: stein197
- License: mit
- Created: 2021-11-06T14:01:04.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-03-07T07:43:11.000Z (about 3 years ago)
- Last Synced: 2025-11-23T15:05:34.259Z (4 months ago)
- Topics: camelcase, case, casing, coverter
- Language: TypeScript
- Homepage:
- Size: 27.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# String case converter and parser
[](LICENSE)

This tiny package provides means for converting strings between different cases - such as converting `camelCase` to `snake_case` and so on.
## Installation
```
npm install @stein197/caser
```
## Usage:
```ts
import * as caser from "@stein197/caser";
caser.covert("HTMLElement", "header", true); // "HTML-Element"
caser.convert("CONSTANT_VALUE", {separator: "-", leadCharCase: "upper", firstCharCase: "upper", case: "lower"}, false); // "Constant-Value"
caser.split("camelCase"); // ["camel", "Case"]
```
### Predefined cases
- `flat` flatcase
- `camel` camelCase
- `header` Header-Case
- `kebab` kebab-case
- `pascal` PascalCase
- `snake` snake_case
- `upper` UPPER_CASE
- `train` TRAIN-CASE
> For detailed documentation, refer to the source code docblocks
## NPM scripts
- `clean` cleans working directory from compiled files
- `build` compiles source code
- `test` runs unit tests