# @guanghechen/option-helper

> a collection of utility functions for processing options

Latest version **1.9.8** (published 2022-07-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install @guanghechen/option-helper
pnpm add @guanghechen/option-helper
yarn add @guanghechen/option-helper
bun add @guanghechen/option-helper
```

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.9.8 |
| Published | 2022-07-27 |
| First published | 2021-03-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >= 14.15.0 |
| Dependencies | 4 |
| Unpacked size | 29.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | guanghechen |
| Maintainers | lemonclown |
| Keywords | type utils, string utils |

## Links

- npm: https://www.npmjs.com/package/@guanghechen/option-helper
- Repository: https://github.com/guanghechen/node-scaffolds
- Homepage: https://github.com/guanghechen/node-scaffolds/tree/main/packages/option-helper#readme
- Issues: https://github.com/guanghechen/node-scaffolds/issues
- npm.io page: https://npm.io/package/@guanghechen/option-helper

## Dependencies (4)

- [lower-case](https://npm.io/package/lower-case.md) ^2.0.1
- [title-case](https://npm.io/package/title-case.md) ^3.0.2
- [upper-case](https://npm.io/package/upper-case.md) ^2.0.1
- [change-case](https://npm.io/package/change-case.md) ^4.1.1

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 1.9.8 (latest) — 2022-07-27
- 1.9.7 — 2022-07-17
- 1.9.6 — 2022-07-10
- 1.9.5 — 2022-06-03
- 1.9.4 — 2022-04-27
- 1.9.3 — 2022-04-10
- 1.9.2 — 2022-03-12
- 1.9.1 — 2022-02-23
- 1.9.0 — 2022-02-17
- 1.9.0-alpha.0 — 2022-02-16
- 1.8.6 — 2022-01-15
- 1.8.5 — 2021-12-05
- 1.8.4 — 2021-10-28
- 1.8.3 — 2021-08-18
- 1.8.2 — 2021-08-14
- … 37 more at https://npm.io/package/@guanghechen/option-helper/versions

## README

<header>
  <h1 align="center">
    <a href="https://github.com/guanghechen/node-scaffolds/tree/main/packages/option-helper#readme">@guanghechen/option-helper</a>
  </h1>
  <div align="center">
    <a href="https://www.npmjs.com/package/@guanghechen/option-helper">
      <img
        alt="Npm Version"
        src="https://img.shields.io/npm/v/@guanghechen/option-helper.svg"
      />
    </a>
    <a href="https://www.npmjs.com/package/@guanghechen/option-helper">
      <img
        alt="Npm Download"
        src="https://img.shields.io/npm/dm/@guanghechen/option-helper.svg"
      />
    </a>
    <a href="https://www.npmjs.com/package/@guanghechen/option-helper">
      <img
        alt="Npm License"
        src="https://img.shields.io/npm/l/@guanghechen/option-helper.svg"
      />
    </a>
    <a href="https://github.com/nodejs/node">
      <img
        alt="Node.js Version"
        src="https://img.shields.io/node/v/@guanghechen/option-helper"
      />
    </a>
    <a href="https://github.com/facebook/jest">
      <img
        alt="Tested with Jest"
        src="https://img.shields.io/badge/tested_with-jest-9c465e.svg"
      />
    </a>
    <a href="https://github.com/prettier/prettier">
      <img
        alt="Code Style: prettier"
        src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square"
      />
    </a>
  </div>
</header>
<br/>


A collection of utility functions for processing options.

## Install

* npm

  ```bash
  npm install --save-dev @guanghechen/option-helper
  ```

* yarn

  ```bash
  yarn add --dev @guanghechen/option-helper
  ```

## Usage


  * `is`

    Name                  | Description
    :--------------------:|:----------------------------------------------------------------
    `isArray`             | Check if the given data is a `Array` type
    `isBigint`            | Check if the given data is a `bigint` type
    `isBoolean`           | Check if the given data is a `boolean` / `Boolean` type
    `isDate`              | Check if the given data is a `Date` type
    `isFunction`          | Check if the given data is a `Function` type
    `isInteger`           | Check if the given data is a `Integer` type
    `isNumber`            | Check if the given data is a `number` / `Number` type
    `isObject`            | Check if the given data is a `Object` type
    `isString`            | Check if the given data is a `string` / `String` type
    `isSymbol`            | Check if the given data is a `symbol` type
    `isUndefined`         | Check if the given data is a `undefined` type
    `isPrimitiveBoolean`  | Check if the given data is a `boolean` type
    `isPrimitiveInteger`  | Check if the given data is a `integer` type
    `isPrimitiveNumber`   | Check if the given data is a `number` type
    `isPrimitiveString`   | Check if the given data is a `string` type
    `isNonBlankString`    | Check if the given data is an non-blank `string` / `String` type
    `isNotEmptyArray`     | Check if the given data is an not-empty `Array` type
    `isNotEmptyObject`    | Check if the given data is an not-empty `Object` type
    `isEmptyObject`       | Check if the given data is an empty `Object` type
    `isNumberLike`        | Check if the given data is an `number` / `Number` or number like `string` type


  * `string` utilities

    Name                  | 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` utilities

    Name                  | Description
    :--------------------:|:---------------------------------------
    `cover`               | -
    `coverBoolean`        | -
    `coverInteger`        | -
    `coverNumber`         | -
    `coverString`         | -

  * `convert` utilities

    Name                  | Description
    :--------------------:|:---------------------------------------
    `convertToBoolean`    | -
    `convertToInteger`    | -
    `convertToNumber`     | -
    `convertToString`     | -


[homepage]: https://github.com/guanghechen/node-scaffolds/tree/main/packages/option-helper#readme

---
_Source: https://npm.io/package/@guanghechen/option-helper · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
