@stein197/caser
v3.1.0
Published
String case converter and parser
Downloads
4
Readme
String case converter and parser
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:
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
flatcasecamel
camelCaseheader
Header-Casekebab
kebab-casepascal
PascalCasesnake
snake_caseupper
UPPER_CASEtrain
TRAIN-CASE
For detailed documentation, refer to the source code docblocks
NPM scripts
clean
cleans working directory from compiled filesbuild
compiles source codetest
runs unit tests