change-case
Quickly convert strings between camelCase
, PascalCase
, Title Case
, snake_case
, lowercase
, UPPERCASE
, CONSTANT_CASE
and more.
Installation
npm install change-case --save
Usage
var changeCase = require('change-case');
isUpperCase changeCase.isUpperCase(string)
Return a boolean indicating the string is upper cased.
changeCase.isUpperCase('test string');
isLowerCase changeCase.isLowerCase(string)
Return a boolean indicating the string is lower cased.
changeCase.isLowerCase('test string');
upperCase changeCase.upperCase(string)
Return an upper cased string.
changeCase.upperCase('test string');
lowerCase changeCase.lowerCase(string)
Return a lower cased string.
changeCase.lowerCase('TEST STRING');
titleCase changeCase.titleCase(string)
Return a space separated string with the first character of every word upper cased.
changeCase.titleCase('a simple test');
sentenceCase changeCase.sentenceCase(string)
Return a lower cased, space separated string.
changeCase.sentenceCase('testString');
camelCase changeCase.camelCase(string)
Return a string with the separators denoted by having the next letter capitalized.
changeCase.camelCase('test string');
pascalCase changeCase.pascalCase(string)
Return a string denoted in the same fashion as camelCase
, but with the first letter also capitalized.
changeCase.pascalCase('test string');
snakeCase changeCase.snakeCase(string)
Return a lower cased, space separated string.
changeCase.snakeCase('test string');
--> "test_string"
paramCase changeCase.paramCase(string)
Return a lower cased, dash separated string.
changeCase.paramCase('test string');
dotCase changeCase.dotCase(string)
Return a lower cased, period separated string.
changeCase.dotCase('test string');
pathCase changeCase.pathCase(string)
Return a lower cased, slash separated string.
changeCase.pathCase('test string');
constantCase changeCase.constantCase(string)
Return an upper cased, underscore separated string.
changeCase.constantCase('test string');
swapCase changeCase.swapCase(string)
Return a string with lower case characters upper cased and upper case character lower cased.
changeCase.swapCase('Test String');
License
MIT