@guanghechen/helper-string
TypeScript icon, indicating that this package has built-in type declarations

6.0.0-alpha.2 • Public • Published

@guanghechen/helper-string


Utilities for processing strings or stringify other type data.

Install

  • npm

    npm install --save-dev @guanghechen/helper-string
  • yarn

    yarn add --dev @guanghechen/helper-string

Usage

  • transformer 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 ITextTransformer into one.

      import {
        composeTextTransformers,
        toKebabCase,
        toTrim,
      } from '@guanghechen/helper-string'
      
      // function composeTextTransformers (
      //   ...transformers: ReadonlyArray<ITextTransformer>
      // ): ITextTransformer
      
      const transform = composeTextTransformers(toTrim, toKebabCase)
      const text: string = transform(' TeSt_StrinG ')
      // => 'test-string'

Package Sidebar

Install

npm i @guanghechen/helper-string

Weekly Downloads

68

Version

6.0.0-alpha.2

License

MIT

Unpacked Size

49.1 kB

Total Files

8

Last publish

Collaborators

  • lemonclown