1 | # camelcase [![Build Status](https://travis-ci.org/sindresorhus/camelcase.svg?branch=master)](https://travis-ci.org/sindresorhus/camelcase)
|
2 |
|
3 | > Convert a dash/dot/underscore/space separated string to camelCase: `foo-bar` → `fooBar`
|
4 |
|
5 |
|
6 | ## Install
|
7 |
|
8 | ```
|
9 | $ npm install --save camelcase
|
10 | ```
|
11 |
|
12 |
|
13 | ## Usage
|
14 |
|
15 | ```js
|
16 | const camelCase = require('camelcase');
|
17 |
|
18 | camelCase('foo-bar');
|
19 | //=> 'fooBar'
|
20 |
|
21 | camelCase('foo_bar');
|
22 | //=> 'fooBar'
|
23 |
|
24 | camelCase('Foo-Bar');
|
25 | //=> 'fooBar'
|
26 |
|
27 | camelCase('--foo.bar');
|
28 | //=> 'fooBar'
|
29 |
|
30 | camelCase('__foo__bar__');
|
31 | //=> 'fooBar'
|
32 |
|
33 | camelCase('foo bar');
|
34 | //=> 'fooBar'
|
35 |
|
36 | console.log(process.argv[3]);
|
37 | //=> '--foo-bar'
|
38 | camelCase(process.argv[3]);
|
39 | //=> 'fooBar'
|
40 |
|
41 | camelCase('foo', 'bar');
|
42 | //=> 'fooBar'
|
43 |
|
44 | camelCase('__foo__', '--bar');
|
45 | //=> 'fooBar'
|
46 | ```
|
47 |
|
48 |
|
49 | ## Related
|
50 |
|
51 | - [decamelize](https://github.com/sindresorhus/decamelize) - The inverse of this module
|
52 | - [uppercamelcase](https://github.com/SamVerschueren/uppercamelcase) - Like this module, but to PascalCase instead of camelCase
|
53 |
|
54 |
|
55 | ## License
|
56 |
|
57 | MIT © [Sindre Sorhus](http://sindresorhus.com)
|