Skip to content
Camel case a string in JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore update to standard style Mar 29, 2015
.travis.yml
LICENSE
README.md Add Greenkeeper badge 🌴 (#12) May 7, 2017
camel-case.d.ts
camel-case.js
package.json
test.js Fix up number separation behaviour Jun 12, 2016

README.md

Camel Case

NPM version NPM downloads Build status Test coverage Greenkeeper badge

Camel case a string. Explicitly adds a single underscore between groups of numbers to maintain readability and reversibility (E.g. 1.20.5 becomes 1_20_5, not 1205), by default.

Supports 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.

Installation

Node

npm install camel-case --save

Usage

var camelCase = require('camel-case')

camelCase('string')         //=> "string"
camelCase('dot.case')       //=> "dotCase"
camelCase('PascalCase')     //=> "pascalCase"
camelCase('version 1.2.10') //=> "version_1_2_10"

camelCase('STRING 1.2', 'tr') //=> "strıng_1_2"

camelCase('string 1 2 3', null, true) //=> "string123"

Typings

Includes a TypeScript definition.

License

MIT

You can’t perform that action at this time.