@guanghechen/option-helper
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 isArrayCheck if the given data is a ArraytypeisBigintCheck if the given data is a biginttypeisBooleanCheck if the given data is a boolean/BooleantypeisDateCheck if the given data is a DatetypeisFunctionCheck if the given data is a FunctiontypeisIntegerCheck if the given data is a IntegertypeisNumberCheck if the given data is a number/NumbertypeisObjectCheck if the given data is a ObjecttypeisStringCheck if the given data is a string/StringtypeisSymbolCheck if the given data is a symboltypeisUndefinedCheck if the given data is a undefinedtypeisPrimitiveBooleanCheck if the given data is a booleantypeisPrimitiveIntegerCheck if the given data is a integertypeisPrimitiveNumberCheck if the given data is a numbertypeisPrimitiveStringCheck if the given data is a stringtypeisNonBlankStringCheck if the given data is an non-blank string/StringtypeisNotEmptyArrayCheck if the given data is an not-empty ArraytypeisNotEmptyObjectCheck if the given data is an not-empty ObjecttypeisEmptyObjectCheck if the given data is an empty ObjecttypeisNumberLikeCheck if the given data is an number/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-