mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 17:47:49 +00:00
Remove createCompounder.
This commit is contained in:
12
camelCase.js
12
camelCase.js
@@ -1,5 +1,5 @@
|
||||
import capitalize from './capitalize.js'
|
||||
import createCompounder from './.internal/createCompounder.js'
|
||||
import words from './words.js'
|
||||
|
||||
/**
|
||||
* Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
|
||||
@@ -20,9 +20,11 @@ import createCompounder from './.internal/createCompounder.js'
|
||||
* camelCase('__FOO_BAR__')
|
||||
* // => 'fooBar'
|
||||
*/
|
||||
const camelCase = createCompounder((result, word, index) => {
|
||||
word = word.toLowerCase()
|
||||
return result + (index ? capitalize(word) : word)
|
||||
})
|
||||
const camelCase = (string) => (
|
||||
words(`${ string }`.replace(/['\u2019]/g, '')).reduce((result, word, index) => {
|
||||
word = word.toLowerCase()
|
||||
return result + (index ? capitalize(word) : word)
|
||||
}, '')
|
||||
)
|
||||
|
||||
export default camelCase
|
||||
|
||||
Reference in New Issue
Block a user