change-case

  • Version 5.4.4
  • Published
  • 35.9 kB
  • No dependencies
  • MIT license

Install

npm i change-case
yarn add change-case
pnpm add change-case

Overview

Transform a string between `camelCase`, `PascalCase`, `Capital Case`, `snake_case`, `kebab-case`, `CONSTANT_CASE` and others

Index

Functions

function camelCase

camelCase: (input: string, options?: PascalCaseOptions) => string;
  • Convert a string to camel case (fooBar).

function capitalCase

capitalCase: (input: string, options?: Options) => string;
  • Convert a string to capital case (Foo Bar).

function constantCase

constantCase: (input: string, options?: Options) => string;
  • Convert a string to constant case (FOO_BAR).

function dotCase

dotCase: (input: string, options?: Options) => string;
  • Convert a string to dot case (foo.bar).

function kebabCase

kebabCase: (input: string, options?: Options) => string;
  • Convert a string to kebab case (foo-bar).

function noCase

noCase: (input: string, options?: Options) => string;
  • Convert a string to space separated lower case (foo bar).

function pascalCase

pascalCase: (input: string, options?: PascalCaseOptions) => string;
  • Convert a string to pascal case (FooBar).

function pascalSnakeCase

pascalSnakeCase: (input: string, options?: Options) => string;
  • Convert a string to pascal snake case (Foo_Bar).

function pathCase

pathCase: (input: string, options?: Options) => string;
  • Convert a string to path case (foo/bar).

function sentenceCase

sentenceCase: (input: string, options?: Options) => string;
  • Convert a string to path case (Foo bar).

function snakeCase

snakeCase: (input: string, options?: Options) => string;
  • Convert a string to snake case (foo_bar).

function split

split: (value: string) => string[];
  • Split any cased input strings into an array of words.

function splitSeparateNumbers

splitSeparateNumbers: (value: string) => string[];
  • Split the input string into an array of words, separating numbers.

function trainCase

trainCase: (input: string, options?: Options) => string;
  • Convert a string to header case (Foo-Bar).

Interfaces

interface Options

interface Options {}
  • Options used for converting strings to any case.

property delimiter

delimiter?: string;

    property locale

    locale?: Locale;

      property prefixCharacters

      prefixCharacters?: string;

        property separateNumbers

        separateNumbers?: boolean;
        • Deprecated

          Pass split: splitSeparateNumbers instead.

        property split

        split?: (value: string) => string[];

          property suffixCharacters

          suffixCharacters?: string;

            interface PascalCaseOptions

            interface PascalCaseOptions extends Options {}
            • Options used for converting strings to pascal/camel case.

            property mergeAmbiguousCharacters

            mergeAmbiguousCharacters?: boolean;

              Type Aliases

              type Locale

              type Locale = string[] | string | false | undefined;
              • Supported locale values. Use false to ignore locale. Defaults to undefined, which uses the host environment.

              Package Files (1)

              Dependencies (0)

              No dependencies.

              Dev Dependencies (0)

              No dev dependencies.

              Peer Dependencies (0)

              No peer dependencies.

              Badge

              To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

              You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/change-case.

              • Markdown
                [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/change-case)
              • HTML
                <a href="https://www.jsdocs.io/package/change-case"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>