Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

change-case

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

change-case - npm Package Compare versions

Comparing version 3.1.0 to 4.0.0

dist.es2015/index.d.ts

128

package.json
{
"name": "change-case",
"version": "3.1.0",
"description": "Convert a string between camelCase, PascalCase, Title Case, snake_case and more.",
"main": "change-case.js",
"typings": "change-case.d.ts",
"version": "4.0.0",
"description": "Transform a string between `camelCase`, `PascalCase`, `Capital Case`, `snake_case`, `param-case`, `CONSTANT_CASE` and others",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"module": "dist.es2015/index.js",
"sideEffects": false,
"jsnext:main": "dist.es2015/index.js",
"files": [
"change-case.js",
"change-case.d.ts",
"dist/",
"dist.es2015/",
"LICENSE"
],
"scripts": {
"lint": "standard",
"test-std": "mocha -- -R spec --bail",
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- -R spec --bail",
"test": "npm run lint && npm run test-cov"
"lint": "tslint \"src/**/*\" --project tsconfig.json",
"build": "rimraf dist/ dist.es2015/ && tsc && tsc -P tsconfig.es2015.json",
"specs": "jest --coverage",
"test": "npm run build && npm run lint && npm run specs && npm run size",
"size": "size-limit",
"prepare": "npm run build"
},
"repository": "https://github.com/blakeembrey/change-case",
"repository": {
"type": "git",
"url": "git://github.com/blakeembrey/change-case.git"
},
"keywords": [
"camel",
"pascal",
"title",
"change",
"case",
"lower",
"upper",
"param",
"kebab",
"hyphen",
"dot",
"path",
"constant",
"cases",
"check"
"convert",
"transform",
"camel-case",
"pascal-case",
"param-case",
"kebab-case",
"header-case"
],

@@ -41,27 +44,58 @@ "author": {

"license": "MIT",
"bugs": {
"url": "https://github.com/blakeembrey/change-case/issues"
},
"homepage": "https://github.com/blakeembrey/change-case/tree/master/packages/camel-case#readme",
"size-limit": [
{
"path": "dist/index.js",
"limit": "750 B"
}
],
"jest": {
"roots": [
"<rootDir>/src/"
],
"transform": {
"\\.tsx?$": "ts-jest"
},
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(tsx?|jsx?)$",
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
]
},
"publishConfig": {
"access": "public"
},
"dependencies": {
"camel-case": "^4.0.0",
"capital-case": "^1.0.0",
"constant-case": "^3.0.0",
"dot-case": "^3.0.0",
"header-case": "^2.0.0",
"no-case": "^3.0.0",
"param-case": "^3.0.0",
"pascal-case": "^3.0.0",
"path-case": "^3.0.0",
"sentence-case": "^3.0.0",
"snake-case": "^3.0.0"
},
"devDependencies": {
"istanbul": "^0.4.3",
"mocha": "^5.0.0",
"standard": "^12.0.1"
"@size-limit/preset-small-lib": "^2.2.1",
"@types/jest": "^24.0.23",
"@types/node": "^12.12.14",
"jest": "^24.9.0",
"rimraf": "^3.0.0",
"ts-jest": "^24.2.0",
"tslint": "^5.20.1",
"tslint-config-prettier": "^1.18.0",
"tslint-config-standard": "^9.0.0",
"typescript": "^3.7.2"
},
"dependencies": {
"camel-case": "^3.0.0",
"constant-case": "^2.0.0",
"dot-case": "^2.1.0",
"header-case": "^1.0.0",
"is-lower-case": "^1.1.0",
"is-upper-case": "^1.1.0",
"lower-case": "^1.1.1",
"lower-case-first": "^1.0.0",
"no-case": "^2.3.2",
"param-case": "^2.1.0",
"pascal-case": "^2.0.0",
"path-case": "^2.1.0",
"sentence-case": "^2.1.0",
"snake-case": "^2.1.0",
"swap-case": "^1.1.0",
"title-case": "^2.1.0",
"upper-case": "^1.1.1",
"upper-case-first": "^1.1.0"
}
"gitHead": "55911ca17c2e0c964b9b84143e14e29ffc9ff499"
}

@@ -5,11 +5,6 @@ # Change Case

[![NPM downloads][downloads-image]][downloads-url]
[![Build status][travis-image]][travis-url]
[![Test coverage][coveralls-image]][coveralls-url]
[![Bundle size][bundlephobia-image]][bundlephobia-url]
Convert strings between `camelCase`, `PascalCase`, `Title Case`, `snake_case`, `lowercase`, `UPPERCASE`, `CONSTANT_CASE` and more.
> Transform a string between `camelCase`, `PascalCase`, `Capital Case`, `snake_case`, `param-case`, `CONSTANT_CASE` and others.
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.
**Methods are also available on npm as an individual packages.**
## Installation

@@ -24,291 +19,19 @@

```js
var changeCase = require('change-case')
//=> { isUpperCase: [Function], camelCase: [Function], ... }
import {
camelCase,
capitalCase,
constantCase,
dotCase,
headerCase,
noCase,
paramCase,
pascalCase,
pathCase,
sentenceCase,
snakeCase
} from "change-case";
```
**Available methods** (short-hand shown below, long-hand available in examples):
All methods available [independently](https://github.com/blakeembrey/change-case).
* [`camel`](#camelcase)
* [`constant`](#constantcase)
* [`dot`](#dotcase)
* [`header`](#headercase)
* [`isLower`](#islowercase)
* [`isUpper`](#isuppercase)
* [`lower`](#lowercase)
* [`lcFirst`](#lowercasefirst)
* [`no`](#nocase)
* [`param`](#paramcase)
* [`pascal`](#pascalcase)
* [`path`](#pathcase)
* [`sentence`](#sentencecase)
* [`snake`](#snakecase)
* [`swap`](#swapcase)
* [`title`](#titlecase)
* [`upper`](#uppercase)
* [`ucFirst`](#uppercasefirst)
All methods accept two arguments, the string to change case and an optional locale.
### [camelCase](https://github.com/blakeembrey/camel-case)
[![NPM version](https://img.shields.io/npm/v/camel-case.svg?style=flat)](https://npmjs.org/package/camel-case)
[![NPM downloads](https://img.shields.io/npm/dm/camel-case.svg?style=flat)](https://npmjs.org/package/camel-case)
[![Build status](https://img.shields.io/travis/blakeembrey/camel-case.svg?style=flat)](https://travis-ci.org/blakeembrey/camel-case)
[![Test coverage](https://img.shields.io/coveralls/blakeembrey/camel-case.svg?style=flat)](https://coveralls.io/r/blakeembrey/camel-case?branch=master)
Return as a string with the separators denoted by having the next letter capitalized.
```js
changeCase.camelCase('test string')
//=> "testString"
```
### [constantCase](https://github.com/blakeembrey/constant-case)
[![NPM version](https://img.shields.io/npm/v/constant-case.svg?style=flat)](https://npmjs.org/package/constant-case)
[![NPM downloads](https://img.shields.io/npm/dm/constant-case.svg?style=flat)](https://npmjs.org/package/constant-case)
[![Build status](https://img.shields.io/travis/blakeembrey/constant-case.svg?style=flat)](https://travis-ci.org/blakeembrey/constant-case)
[![Test coverage](https://img.shields.io/coveralls/blakeembrey/constant-case.svg?style=flat)](https://coveralls.io/r/blakeembrey/constant-case?branch=master)
Return as an upper case, underscore separated string.
```js
changeCase.constantCase('test string')
//=> "TEST_STRING"
```
### [dotCase](https://github.com/blakeembrey/dot-case)
[![NPM version](https://img.shields.io/npm/v/dot-case.svg?style=flat)](https://npmjs.org/package/dot-case)
[![NPM downloads](https://img.shields.io/npm/dm/dot-case.svg?style=flat)](https://npmjs.org/package/dot-case)
[![Build status](https://img.shields.io/travis/blakeembrey/dot-case.svg?style=flat)](https://travis-ci.org/blakeembrey/dot-case)
[![Test coverage](https://img.shields.io/coveralls/blakeembrey/dot-case.svg?style=flat)](https://coveralls.io/r/blakeembrey/dot-case?branch=master)
Return as a lower case, period separated string.
```js
changeCase.dotCase('test string')
//=> "test.string"
```
### [headerCase](https://github.com/blakeembrey/header-case)
[![NPM version](https://img.shields.io/npm/v/header-case.svg?style=flat)](https://npmjs.org/package/header-case)
[![NPM downloads](https://img.shields.io/npm/dm/header-case.svg?style=flat)](https://npmjs.org/package/header-case)
[![Build status](https://img.shields.io/travis/blakeembrey/header-case.svg?style=flat)](https://travis-ci.org/blakeembrey/header-case)
[![Test coverage](https://img.shields.io/coveralls/blakeembrey/header-case.svg?style=flat)](https://coveralls.io/r/blakeembrey/header-case?branch=master)
Return as a title cased, dash separated string.
```js
changeCase.headerCase('test string')
//=> "Test-String"
```
### [isLowerCase](https://github.com/blakeembrey/is-lower-case)
[![NPM version](https://img.shields.io/npm/v/is-lower-case.svg?style=flat)](https://npmjs.org/package/is-lower-case)
[![NPM downloads](https://img.shields.io/npm/dm/is-lower-case.svg?style=flat)](https://npmjs.org/package/is-lower-case)
[![Build status](https://img.shields.io/travis/blakeembrey/is-lower-case.svg?style=flat)](https://travis-ci.org/blakeembrey/is-lower-case)
[![Test coverage](https://img.shields.io/coveralls/blakeembrey/is-lower-case.svg?style=flat)](https://coveralls.io/r/blakeembrey/is-lower-case?branch=master)
Return a boolean indicating whether the string is lower cased.
```js
changeCase.isLowerCase('test string')
//=> true
```
### [isUpperCase](https://github.com/blakeembrey/is-upper-case)
[![NPM version](https://img.shields.io/npm/v/is-upper-case.svg?style=flat)](https://npmjs.org/package/is-upper-case)
[![NPM downloads](https://img.shields.io/npm/dm/is-upper-case.svg?style=flat)](https://npmjs.org/package/is-upper-case)
[![Build status](https://img.shields.io/travis/blakeembrey/is-upper-case.svg?style=flat)](https://travis-ci.org/blakeembrey/is-upper-case)
[![Test coverage](https://img.shields.io/coveralls/blakeembrey/is-upper-case.svg?style=flat)](https://coveralls.io/r/blakeembrey/is-upper-case?branch=master)
Return a boolean indicating whether the string is upper cased.
```js
changeCase.isUpperCase('test string')
//=> false
```
### [lowerCase](https://github.com/blakeembrey/lower-case)
[![NPM version](https://img.shields.io/npm/v/lower-case.svg?style=flat)](https://npmjs.org/package/lower-case)
[![NPM downloads](https://img.shields.io/npm/dm/lower-case.svg?style=flat)](https://npmjs.org/package/lower-case)
[![Build status](https://img.shields.io/travis/blakeembrey/lower-case.svg?style=flat)](https://travis-ci.org/blakeembrey/lower-case)
[![Test coverage](https://img.shields.io/coveralls/blakeembrey/lower-case.svg?style=flat)](https://coveralls.io/r/blakeembrey/lower-case?branch=master)
Return the string in lower case.
```js
changeCase.lowerCase('TEST STRING')
//=> "test string"
```
### [lowerCaseFirst](https://github.com/blakeembrey/lower-case-first)
[![NPM version](https://img.shields.io/npm/v/lower-case-first.svg?style=flat)](https://npmjs.org/package/lower-case-first)
[![NPM downloads](https://img.shields.io/npm/dm/lower-case-first.svg?style=flat)](https://npmjs.org/package/lower-case-first)
[![Build status](https://img.shields.io/travis/blakeembrey/lower-case-first.svg?style=flat)](https://travis-ci.org/blakeembrey/lower-case-first)
[![Test coverage](https://img.shields.io/coveralls/blakeembrey/lower-case-first.svg?style=flat)](https://coveralls.io/r/blakeembrey/lower-case-first?branch=master)
Return the string with the first character lower cased.
```js
changeCase.lowerCaseFirst('TEST')
//=> "tEST"
```
### [noCase](https://github.com/blakeembrey/no-case)
[![NPM version](https://img.shields.io/npm/v/no-case.svg?style=flat)](https://npmjs.org/package/no-case)
[![NPM downloads](https://img.shields.io/npm/dm/no-case.svg?style=flat)](https://npmjs.org/package/no-case)
[![Build status](https://img.shields.io/travis/blakeembrey/no-case.svg?style=flat)](https://travci.org/blakeembrey/no-case)
[![Test coverage](https://img.shields.io/coveralls/blakeembrey/no-case.svg?style=flat)](https://coveralls.io/r/blakeembrey/no-case?branch=master)
Return the string without any casing (lower case, space separated).
```js
changeCase.noCase('test string')
//=> "test string"
```
### [paramCase](https://github.com/blakeembrey/param-case)
[![NPM version](https://img.shields.io/npm/v/param-case.svg?style=flat)](https://npmjs.org/package/param-case)
[![NPM downloads](https://img.shields.io/npm/dm/param-case.svg?style=flat)](https://npmjs.org/package/param-case)
[![Build status](https://img.shields.io/travis/blakeembrey/param-case.svg?style=flat)](https://travis-ci.org/blakeembrey/param-case)
[![Test coverage](https://img.shields.io/coveralls/blakeembrey/param-case.svg?style=flat)](https://coveralls.io/r/blakeembrey/param-case?branch=master)
Return as a lower case, dash separated string.
```js
changeCase.paramCase('test string')
//=> "test-string"
```
### [pascalCase](https://github.com/blakeembrey/pascal-case)
[![NPM version](https://img.shields.io/npm/v/pascal-case.svg?style=flat)](https://npmjs.org/package/pascal-case)
[![NPM downloads](https://img.shields.io/npm/dm/pascal-case.svg?style=flat)](https://npmjs.org/package/pascal-case)
[![Build status](https://img.shields.io/travis/blakeembrey/pascal-case.svg?style=flat)](https://travis-ci.org/blakeembrey/pascal-case)
[![Test coverage](https://img.shields.io/coveralls/blakeembrey/pascal-case.svg?style=flat)](https://coveralls.io/r/blakeembrey/pascal-case?branch=master)
Return as a string denoted in the same fashion as `camelCase`, but with the first letter also capitalized.
```js
changeCase.pascalCase('test string')
//=> "TestString"
```
### [pathCase](https://github.com/blakeembrey/path-case)
[![NPM version](https://img.shields.io/npm/v/path-case.svg?style=flat)](https://npmjs.org/package/path-case)
[![NPM downloads](https://img.shields.io/npm/dm/path-case.svg?style=flat)](https://npmjs.org/package/path-case)
[![Build status](https://img.shields.io/travis/blakeembrey/path-case.svg?style=flat)](https://travis-ci.org/blakeembrey/path-case)
[![Test coverage](https://img.shields.io/coveralls/blakeembrey/path-case.svg?style=flat)](https://coveralls.io/r/blakeembrey/path-case?branch=master)
Return as a lower case, slash separated string.
```js
changeCase.pathCase('test string')
//=> "test/string"
```
### [sentenceCase](https://github.com/blakeembrey/sentence-case)
[![NPM version](https://img.shields.io/npm/v/sentence-case.svg?style=flat)](https://npmjs.org/package/sentence-case)
[![NPM downloads](https://img.shields.io/npm/dm/sentence-case.svg?style=flat)](https://npmjs.org/package/sentence-case)
[![Build status](https://img.shields.io/travis/blakeembrey/sentence-case.svg?style=flat)](https://travis-ci.org/blakeembrey/sentence-case)
[![Test coverage](https://img.shields.io/coveralls/blakeembrey/sentence-case.svg?style=flat)](https://coveralls.io/r/blakeembrey/sentence-case?branch=master)
Return as a lower case, space separated string with the first letter upper case.
```js
changeCase.sentenceCase('testString')
//=> "Test string"
```
### [snakeCase](https://github.com/blakeembrey/snake-case)
[![NPM version](https://img.shields.io/npm/v/snake-case.svg?style=flat)](https://npmjs.org/package/snake-case)
[![NPM downloads](https://img.shields.io/npm/dm/snake-case.svg?style=flat)](https://npmjs.org/package/snake-case)
[![Build status](https://img.shields.io/travis/blakeembrey/snake-case.svg?style=flat)](https://travis-ci.org/blakeembrey/snake-case)
[![Test coverage](https://img.shields.io/coveralls/blakeembrey/snake-case.svg?style=flat)](https://coveralls.io/r/blakeembrey/snake-case?branch=master)
Return as a lower case, underscore separated string.
```js
changeCase.snakeCase('test string')
//=> "test_string"
```
### [swapCase](https://github.com/blakeembrey/swap-case)
[![NPM version](https://img.shields.io/npm/v/swap-case.svg?style=flat)](https://npmjs.org/package/swap-case)
[![NPM downloads](https://img.shields.io/npm/dm/swap-case.svg?style=flat)](https://npmjs.org/package/swap-case)
[![Build status](https://img.shields.io/travis/blakeembrey/swap-case.svg?style=flat)](https://travis-ci.org/blakeembrey/swap-case)
[![Test coverage](https://img.shields.io/coveralls/blakeembrey/swap-case.svg?style=flat)](https://coveralls.io/r/blakeembrey/swap-case?branch=master)
Return as a string with every character case reversed.
```js
changeCase.swapCase('Test String')
//=> "tEST sTRING"
```
### [titleCase](https://github.com/blakeembrey/title-case)
[![NPM version](https://img.shields.io/npm/v/title-case.svg?style=flat)](https://npmjs.org/package/title-case)
[![NPM downloads](https://img.shields.io/npm/dm/title-case.svg?style=flat)](https://npmjs.org/package/title-case)
[![Build status](https://img.shields.io/travis/blakeembrey/title-case.svg?style=flat)](https://travis-ci.org/blakeembrey/title-case)
[![Test coverage](https://img.shields.io/coveralls/blakeembrey/title-case.svg?style=flat)](https://coveralls.io/r/blakeembrey/title-case?branch=master)
Return as a space separated string with the first character of every word upper cased.
```js
changeCase.titleCase('a simple test')
//=> "A Simple Test"
```
### [upperCase](https://github.com/blakeembrey/upper-case)
[![NPM version](https://img.shields.io/npm/v/upper-case.svg?style=flat)](https://npmjs.org/package/upper-case)
[![NPM downloads](https://img.shields.io/npm/dm/upper-case.svg?style=flat)](https://npmjs.org/package/upper-case)
[![Build status](https://img.shields.io/travis/blakeembrey/upper-case.svg?style=flat)](https://travci.org/blakeembrey/upper-case)
[![Test coverage](https://img.shields.io/coveralls/blakeembrey/upper-case.svg?style=flat)](https://coveralls.io/r/blakeembrey/upper-case?branch=master)
Return the string in upper case.
```js
changeCase.upperCase('test string')
//=> "TEST STRING"
```
### [upperCaseFirst](https://github.com/blakeembrey/upper-case-first)
[![NPM version](https://img.shields.io/npm/v/upper-case-first.svg?style=flat)](https://npmjs.org/package/upper-case-first)
[![NPM downloads](https://img.shields.io/npm/dm/upper-case-first.svg?style=flat)](https://npmjs.org/package/upper-case-first)
[![Build status](https://img.shields.io/travis/blakeembrey/upper-case-first.svg?style=flat)](https://travis-ci.org/blakeembrey/upper-case-first)
[![Test coverage](https://img.shields.io/coveralls/blakeembrey/upper-case-first.svg?style=flat)](https://coveralls.io/r/blakeembrey/upper-case-first?branch=master)
Return the string with the first character upper cased.
```js
changeCase.upperCaseFirst('test')
//=> "Test"
```
## Related
* [Meteor](https://github.com/Konecty/change-case)
* [Atom](https://github.com/robhurring/atom-change-case)
* [VSCode](https://github.com/wmaurer/vscode-change-case)
## TypeScript
Includes a [TypeScript definition](change-case.d.ts).
## License

@@ -322,5 +45,3 @@

[downloads-url]: https://npmjs.org/package/change-case
[travis-image]: https://img.shields.io/travis/blakeembrey/change-case.svg?style=flat
[travis-url]: https://travis-ci.org/blakeembrey/change-case
[coveralls-image]: https://img.shields.io/coveralls/blakeembrey/change-case.svg?style=flat
[coveralls-url]: https://coveralls.io/r/blakeembrey/change-case?branch=master
[bundlephobia-image]: https://img.shields.io/bundlephobia/minzip/change-case.svg
[bundlephobia-url]: https://bundlephobia.com/result?p=change-case
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc