name-transform
v1.3.0
Published
typescript-template
Downloads
11
Readme
name-transform
A tiny library for transforming names.
Features
- Tiny size
Typescript
supportumd
andcjs
Usage
/*
camel --> 'helloWorld'
pascal --> 'HelloWorld'
hyphen --> 'hello-world'
underscore --> 'hello_world'
*/
import {
camelToHyphen,
camelToPascal,
camelToUnderscore,
pascalToCamel,
pascalToHyphen,
pascalToUnderscore,
underscoreToCamel,
underscoreToHyphen,
underscoreToPascal,
} from 'name-transform'
camelToUnderscore('helloWorld') // =>'hello_world'
camelToPascal('helloWorld') // =>'HelloWorld'
camelToHyphen('helloWorld') // =>'hello-world'
pascalToCamel('HelloWorld') // =>'helloWorld'
pascalToHyphen('HelloWorld') // =>'hello-world'
pascalToUnderscore('HelloWorld') // =>'hello_world'
underscoreToCamel('hello_world') // =>'helloWorld'
underscoreToPascal('hello_world') // =>'HelloWorld'
underscoreToHyphen('hello_world') // =>'hello-world'