@guanghechen/option-helper
v1.9.8
Published
a collection of utility functions for processing options
Readme
A collection of utility functions for processing options.
Install
npm
npm install --save-dev @guanghechen/option-helperyarn
yarn add --dev @guanghechen/option-helper
Usage
isName | Description :--------------------:|:----------------------------------------------------------------
isArray| Check if the given data is aArraytypeisBigint| Check if the given data is abiginttypeisBoolean| Check if the given data is aboolean/BooleantypeisDate| Check if the given data is aDatetypeisFunction| Check if the given data is aFunctiontypeisInteger| Check if the given data is aIntegertypeisNumber| Check if the given data is anumber/NumbertypeisObject| Check if the given data is aObjecttypeisString| Check if the given data is astring/StringtypeisSymbol| Check if the given data is asymboltypeisUndefined| Check if the given data is aundefinedtypeisPrimitiveBoolean| Check if the given data is abooleantypeisPrimitiveInteger| Check if the given data is aintegertypeisPrimitiveNumber| Check if the given data is anumbertypeisPrimitiveString| Check if the given data is astringtypeisNonBlankString| Check if the given data is an non-blankstring/StringtypeisNotEmptyArray| Check if the given data is an not-emptyArraytypeisNotEmptyObject| Check if the given data is an not-emptyObjecttypeisEmptyObject| Check if the given data is an emptyObjecttypeisNumberLike| Check if the given data is annumber/Numberor number likestringtypestringutilitiesName | 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.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'
coverutilitiesName | Description :--------------------:|:---------------------------------------
cover| -coverBoolean| -coverInteger| -coverNumber| -coverString| -convertutilitiesName | Description :--------------------:|:---------------------------------------
convertToBoolean| -convertToInteger| -convertToNumber| -convertToString| -
