1.9.8 • Published 2 years ago

@guanghechen/option-helper v1.9.8

Weekly downloads
133
License
MIT
Repository
github
Last release
2 years ago

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

    NameDescription
    isArrayCheck if the given data is a Array type
    isBigintCheck if the given data is a bigint type
    isBooleanCheck if the given data is a boolean / Boolean type
    isDateCheck if the given data is a Date type
    isFunctionCheck if the given data is a Function type
    isIntegerCheck if the given data is a Integer type
    isNumberCheck if the given data is a number / Number type
    isObjectCheck if the given data is a Object type
    isStringCheck if the given data is a string / String type
    isSymbolCheck if the given data is a symbol type
    isUndefinedCheck if the given data is a undefined type
    isPrimitiveBooleanCheck if the given data is a boolean type
    isPrimitiveIntegerCheck if the given data is a integer type
    isPrimitiveNumberCheck if the given data is a number type
    isPrimitiveStringCheck if the given data is a string type
    isNonBlankStringCheck if the given data is an non-blank string / String type
    isNotEmptyArrayCheck if the given data is an not-empty Array type
    isNotEmptyObjectCheck if the given data is an not-empty Object type
    isEmptyObjectCheck if the given data is an empty Object type
    isNumberLikeCheck if the given data is an number / Number or number like string type
  • string utilities

    NameDescription
    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 utilities

    NameDescription
    cover-
    coverBoolean-
    coverInteger-
    coverNumber-
    coverString-
  • convert utilities

    NameDescription
    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