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

1.0.1 • Public • Published

Utilities for processing strings or stringify other type data.

Install

  • npm

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

    yarn add --dev @guanghechen/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/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/string

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

20.2 kB

Total Files

5

Last publish

Collaborators

  • lemonclown