dot-case

WebJar for dot-case

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

dot-case
Last Version

Last Version

3.0.3
Release Date

Release Date

Type

Type

jar
Description

Description

dot-case
WebJar for dot-case
Project URL

Project URL

https://www.webjars.org
Source Code Management

Source Code Management

https://github.com/blakeembrey/change-case

Download dot-case

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/dot-case/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>dot-case</artifactId>
    <version>3.0.3</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/dot-case/
implementation 'org.webjars.npm:dot-case:3.0.3'
// https://jarcasting.com/artifacts/org.webjars.npm/dot-case/
implementation ("org.webjars.npm:dot-case:3.0.3")
'org.webjars.npm:dot-case:jar:3.0.3'
<dependency org="org.webjars.npm" name="dot-case" rev="3.0.3">
  <artifact name="dot-case" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='dot-case', version='3.0.3')
)
libraryDependencies += "org.webjars.npm" % "dot-case" % "3.0.3"
[org.webjars.npm/dot-case "3.0.3"]

Dependencies

compile (2)

Group / Artifact Type Version
org.webjars.npm : no-case jar [3.0.3,4)
org.webjars.npm : tslib jar [1.10.0,2)

Project Modules

There are no modules declared in this project.

Change Case

Build status

Transform a string between camelCase, PascalCase, Capital Case, snake_case, param-case, CONSTANT_CASE and others.

Installation

npm install change-case --save

Usage

import * as changeCase from "change-case";

Core

These functions come bundled with change-case:

All core methods accept options as the second argument.

camelCase

Transform into a string with the separator denoted by the next word capitalized.

camelCase("test string");
//=> "testString"

capitalCase

Transform into a space separated string with each word capitalized.

capitalCase("test string");
//=> "Test String"

constantCase

Transform into upper case string with an underscore between words.

constantCase("test string");
//=> "TEST_STRING"

dotCase

Transform into a lower case string with a period between words.

dotCase("test string");
//=> "test.string"

headerCase

Transform into a dash separated string of capitalized words.

headerCase("test string");
//=> "Test-String"

noCase

Transform into a lower cased string with spaces between words.

noCase("test string");
//=> "test string"

paramCase

Transform into a lower cased string with dashes between words.

paramCase("test string");
//=> "test-string"

pascalCase

Transform into a string of capitalized words without separators.

pascalCase("test string");
//=> "TestString"

pathCase

Transform into a lower case string with slashes between words.

pathCase("test string");
//=> "test/string"

sentenceCase

Transform into a lower case with spaces between words, then capitalize the string.

sentenceCase("testString");
//=> "Test string"

snakeCase

Transform into a lower case string with underscores between words.

snakeCase("test string");
//=> "test_string"

Other Case Utilities

These functions are not "case" libraries but independent functions, you must install these separately.

titleCase

Transform a string into title case following English rules.

titleCase("a simple test");
//=> "A Simple Test"

swapCase

Transform a string by swapping every character from upper to lower case, or lower to upper case.

swapCase("Test String");
//=> "tEST sTRING"

isLowerCase

Returns true if the string is lower case only.

isLowerCase("test string");
//=> true

isUpperCase

Returns true if the string is upper case only.

isUpperCase("test string");
//=> false

lowerCase

Transforms the string to lower case.

lowerCase("TEST STRING");
//=> "test string"

lowerCaseFirst

Transforms the string with the first character in lower cased.

lowerCaseFirst("TEST");
//=> "tEST"

upperCase

Transforms the string to upper case.

upperCase("test string");
//=> "TEST STRING"

upperCaseFirst

Transforms the string with the first character in upper cased.

upperCaseFirst("test");
//=> "Test"

spongeCase

Transform into a string with random capitalization applied.

spongeCase("Test String");
//=> "tEst stRINg"

Options

  • splitRegexp RegExp used to split into word segments (see example).
  • stripRegexp RegExp used to remove extraneous characters (default: /[^A-Z0-9]/gi).
  • delimiter Value used between words (e.g. " ").
  • transform Used to transform each word segment (e.g. lowerCase).

Split Example

If you find the default split hard to use, you can provide a different one. The example below will change the behavior to word2019 -> word 2019 and minifyURLs -> minify urls:

const options = {
  splitRegexp: /([a-z])([A-Z0-9])/g,
};

Related

License

MIT

Versions

Version
3.0.3
2.1.1
1.1.2