JSPM

@guanghechen/string

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 29
  • Score
    100M100P100Q70426F
  • License MIT

Utilities for processing strings or stringify other type data.

Package Exports

  • @guanghechen/string

Readme

@guanghechen/string


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'