@guanghechen/option-helper
A collection of utility functions for processing options.
Install
npm
npm install --save-dev @guanghechen/option-helper
yarn
yarn add --dev @guanghechen/option-helper
Usage
is
Name | Description :--------------------:|:----------------------------------------------------------------
isArray
| Check if the given data is aArray
typeisBigint
| Check if the given data is abigint
typeisBoolean
| Check if the given data is aboolean
/Boolean
typeisDate
| Check if the given data is aDate
typeisFunction
| Check if the given data is aFunction
typeisInteger
| Check if the given data is aInteger
typeisNumber
| Check if the given data is anumber
/Number
typeisObject
| Check if the given data is aObject
typeisString
| Check if the given data is astring
/String
typeisSymbol
| Check if the given data is asymbol
typeisUndefined
| Check if the given data is aundefined
typeisPrimitiveBoolean
| Check if the given data is aboolean
typeisPrimitiveInteger
| Check if the given data is ainteger
typeisPrimitiveNumber
| Check if the given data is anumber
typeisPrimitiveString
| Check if the given data is astring
typeisNonBlankString
| Check if the given data is an non-blankstring
/String
typeisNotEmptyArray
| Check if the given data is an not-emptyArray
typeisNotEmptyObject
| Check if the given data is an not-emptyObject
typeisEmptyObject
| Check if the given data is an emptyObject
typeisNumberLike
| Check if the given data is annumber
/Number
or number likestring
type
string
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 TextTransformer into one.
```typescript
import {
composeTextTransformers,
toKebabCase,
toTrim,
} from '@guanghechen/option-helper'
// function composeTextTransformers (
// ...transformers: ReadonlyArray<TextTransformer>
// ): TextTransformer
const transform = composeTextTransformers(toTrim, toKebabCase)
const text: string = transform(' TeSt_StrinG ')
// => 'test-string'
```
cover
utilitiesName | Description :--------------------:|:---------------------------------------
cover
| -coverBoolean
| -coverInteger
| -coverNumber
| -coverString
| -convert
utilitiesName | Description :--------------------:|:---------------------------------------
convertToBoolean
| -convertToInteger
| -convertToNumber
| -convertToString
| -