@guanghechen/helper-string
v6.0.0-alpha.2
Published
Utilities for processing strings or stringify other type data.
Downloads
609
Maintainers
Readme
Utilities for processing strings or stringify other type data.
Install
npm
npm install --save-dev @guanghechen/helper-string
yarn
yarn add --dev @guanghechen/helper-string
Usage
transformer
utilitiesName | Description :--------------------:|:---------------------------------------
toCamelCase
|'test string' => 'testString'
toCapitalCase
|'test string' => 'Test String'
toConstantCase
|'test string' => 'TEST_STRING'
toDotCase
|'test string' => 'test.string'
toKebabCase
|'test string' => 'test-string'
toLowerCase
|'TEST STRING' => 'test string'
toPascalCase
|'test string' => 'TestString'
toPathCase
|'test string' => 'test/string'
toSentenceCase
|'testString' => 'Test string'
toSnakeCase
|'test string' => 'test_string'
toTitleCase
|'a simple test' => 'A Simple Test'
toUpperCase
|'test string' => 'TEST STRING'
composeTextTransformers
: Compose multiple ITextTransformer into one.import { composeTextTransformers, toKebabCase, toTrim, } from '@guanghechen/helper-string' // function composeTextTransformers ( // ...transformers: ReadonlyArray<ITextTransformer> // ): ITextTransformer const transform = composeTextTransformers(toTrim, toKebabCase) const text: string = transform(' TeSt_StrinG ') // => 'test-string'