COLLECTED BY
Organization:
Internet Archive
Focused crawls are collections of frequently-updated webcrawl data from narrow (as opposed to broad or wide) web crawls, often focused on a single domain or subdomain.
The Wayback Machine - https://web.archive.org/web/20201220220204/https://github.com/lodash/lodash/blob/master/camelCase.js
Permalink
Cannot retrieve contributors at this time
31 lines (29 sloc)
811 Bytes
import upperFirst from './upperFirst.js'
import words from './words.js'
import toString from './toString.js'
/**
* Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
*
* @since 3.0.0
* @category String
* @param {string } [string=''] The string to convert.
* @returns {string } Returns the camel cased string.
* @see lowerCase, kebabCase, snakeCase, startCase, upperCase, upperFirst
* @example
*
* camelCase('Foo Bar')
* // => 'fooBar'
*
* camelCase('--foo-bar--')
* // => 'fooBar'
*
* camelCase('__FOO_BAR__')
* // => 'fooBar'
*/
const camelCase = ( string ) => (
words ( toString ( string ) . replace ( /[ '\u 2019] /g , '' ) ) . reduce ( ( result , word , index ) => {
word = word . toLowerCase ( )
return result + ( index ? upperFirst ( word ) : word )
} , '' )
)
export default camelCase
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.