GT2/GT2-iOS/node_modules/change-case
Ren Ren Juan 30eef7d036 correct tree err 2018-02-12 17:26:06 +00:00
..
LICENSE correct tree err 2018-02-12 17:26:06 +00:00
README.md correct tree err 2018-02-12 17:26:06 +00:00
change-case.d.ts correct tree err 2018-02-12 17:26:06 +00:00
change-case.js correct tree err 2018-02-12 17:26:06 +00:00
package.json correct tree err 2018-02-12 17:26:06 +00:00

README.md

Change Case

NPM version NPM downloads Build status Test coverage

Convert strings between camelCase, PascalCase, Title Case, snake_case, lowercase, UPPERCASE, CONSTANT_CASE and more.

All methods support Unicode (non-ASCII characters) and non-string entities, such as objects with a toString property, numbers and booleans. Empty values (null and undefined) will result in an empty string.

Every method is also available on npm as an individual package.

Installation

npm install change-case --save

Usage

var changeCase = require('change-case')
//=> { isUpperCase: [Function], camelCase: [Function], ... }

Available methods (short-hand shown below, long-hand available in examples):

  • isUpper
  • isLower
  • upper
  • ucFirst
  • lcFirst
  • lower
  • sentence
  • title
  • camel
  • pascal
  • snake
  • param
  • dot
  • path
  • constant
  • swap

All methods accept two arguments, the string to change case and an optional locale.

isUpperCase

NPM version NPM downloads Build status Test coverage

Return a boolean indicating whether the string is upper cased.

changeCase.isUpperCase('test string')
//=> false

isLowerCase

NPM version NPM downloads Build status Test coverage

Return a boolean indicating whether the string is lower cased.

changeCase.isLowerCase('test string')
//=> true

upperCase

NPM version NPM downloads Build status Test coverage

Return the string in upper case.

changeCase.upperCase('test string')
//=> "TEST STRING"

upperCaseFirst

NPM version NPM downloads Build status Test coverage

Return the string with the first character upper cased.

changeCase.upperCaseFirst('test')
//=> "Test"

lowerCaseFirst

NPM version NPM downloads Build status Test coverage

Return the string with the first character lower cased.

changeCase.lowerCaseFirst('TEST')
//=> "tEST"

lowerCase

NPM version NPM downloads Build status Test coverage

Return the string in lower case.

changeCase.lowerCase('TEST STRING')
//=> "test string"

sentenceCase

NPM version NPM downloads Build status Test coverage

Return as a lower case, space separated string.

changeCase.sentenceCase('testString')
//=> "test string"

titleCase

NPM version NPM downloads Build status Test coverage

Return as a space separated string with the first character of every word upper cased.

changeCase.titleCase('a simple test')
//=> "A Simple Test"

camelCase

NPM version NPM downloads Build status Test coverage

Return as a string with the separators denoted by having the next letter capitalized.

changeCase.camelCase('test string')
//=> "testString"

pascalCase

NPM version NPM downloads Build status Test coverage

Return as a string denoted in the same fashion as camelCase, but with the first letter also capitalized.

changeCase.pascalCase('test string')
//=> "TestString"

snakeCase

NPM version NPM downloads Build status Test coverage

Return as a lower case, underscore separated string.

changeCase.snakeCase('test string')
//=> "test_string"

paramCase

NPM version NPM downloads Build status Test coverage

Return as a lower case, dash separated string.

changeCase.paramCase('test string')
//=> "test-string"

dotCase

NPM version NPM downloads Build status Test coverage

Return as a lower case, period separated string.

changeCase.dotCase('test string')
//=> "test.string"

pathCase

NPM version NPM downloads Build status Test coverage

Return as a lower case, slash separated string.

changeCase.pathCase('test string')
//=> "test/string"

constantCase

NPM version NPM downloads Build status Test coverage

Return as an upper case, underscore separated string.

changeCase.constantCase('test string')
//=> "TEST_STRING"

swapCase

NPM version NPM downloads Build status Test coverage

Return as a string with every character case reversed.

changeCase.swapCase('Test String')
//=> "tEST sTRING"

Typings

Includes a TypeScript definition.

License

MIT