mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 17:47:49 +00:00
Remove createCompounder.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import createCompounder from './.internal/createCompounder.js'
|
||||
import words from './words.js'
|
||||
|
||||
/**
|
||||
* Converts `string` to
|
||||
@@ -20,8 +20,10 @@ import createCompounder from './.internal/createCompounder.js'
|
||||
* snakeCase('--FOO-BAR--')
|
||||
* // => 'foo_bar'
|
||||
*/
|
||||
const snakeCase = createCompounder((result, word, index) =>
|
||||
result + (index ? '_' : '') + word.toLowerCase()
|
||||
const snakeCase = (string) => (
|
||||
words(`${ string }`.replace(/['\u2019]/g, '')).reduce((result, word, index) => (
|
||||
result + (index ? '_' : '') + word.toLowerCase()
|
||||
), '')
|
||||
)
|
||||
|
||||
export default snakeCase
|
||||
|
||||
Reference in New Issue
Block a user