1.9.8 • Published 2 years ago
@guanghechen/option-helper v1.9.8
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 a Array
typeisBigint
Check if the given data is a bigint
typeisBoolean
Check if the given data is a boolean
/Boolean
typeisDate
Check if the given data is a Date
typeisFunction
Check if the given data is a Function
typeisInteger
Check if the given data is a Integer
typeisNumber
Check if the given data is a number
/Number
typeisObject
Check if the given data is a Object
typeisString
Check if the given data is a string
/String
typeisSymbol
Check if the given data is a symbol
typeisUndefined
Check if the given data is a undefined
typeisPrimitiveBoolean
Check if the given data is a boolean
typeisPrimitiveInteger
Check if the given data is a integer
typeisPrimitiveNumber
Check if the given data is a number
typeisPrimitiveString
Check if the given data is a string
typeisNonBlankString
Check if the given data is an non-blank string
/String
typeisNotEmptyArray
Check if the given data is an not-empty Array
typeisNotEmptyObject
Check if the given data is an not-empty Object
typeisEmptyObject
Check if the given data is an empty Object
typeisNumberLike
Check if the given data is an number
/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
-
1.9.8
2 years ago
1.9.7
2 years ago
1.9.6
2 years ago
1.9.5
2 years ago
1.9.4
2 years ago
1.9.3
2 years ago
1.9.2
2 years ago
1.9.0-alpha.0
2 years ago
1.9.1
2 years ago
1.9.0
2 years ago
1.8.6
2 years ago
1.8.5
2 years ago
1.8.4
3 years ago
1.8.3
3 years ago
1.8.2
3 years ago
1.8.1
3 years ago
1.8.0
3 years ago
1.7.1
3 years ago
1.7.0
3 years ago
1.7.0-alpha.3
3 years ago
1.7.0-alpha.1
3 years ago
1.7.0-alpha.2
3 years ago
1.7.0-alpha.0
3 years ago
1.6.1
3 years ago
1.6.0
3 years ago
1.5.5
3 years ago
1.5.4
3 years ago
1.5.3
3 years ago
1.5.2
3 years ago
1.5.1
3 years ago
1.5.0
3 years ago
1.4.1
3 years ago
1.4.0
3 years ago
1.3.1
3 years ago
1.3.0
3 years ago
1.2.1
3 years ago
1.2.0
3 years ago
1.1.0
3 years ago
1.0.13
3 years ago
1.0.11
3 years ago
1.0.12
3 years ago
1.0.9
3 years ago
1.0.10
3 years ago
1.0.8
3 years ago
1.0.7
3 years ago
1.0.6
3 years ago
1.0.5
3 years ago
1.0.4
3 years ago
1.0.3
3 years ago
1.0.2
3 years ago
1.0.1
3 years ago
1.0.0
3 years ago