UNPKG

325 BJavaScriptView Raw
1
2var space = require('to-space-case')
3
4/**
5 * Export.
6 */
7
8module.exports = toCamelCase
9
10/**
11 * Convert a `string` to camel case.
12 *
13 * @param {String} string
14 * @return {String}
15 */
16
17function toCamelCase(string) {
18 return space(string).replace(/\s(\w)/g, function (matches, letter) {
19 return letter.toUpperCase()
20 })
21}