Remove createCompounder.

This commit is contained in:
John-David Dalton
2017-03-26 21:27:06 -07:00
parent 4b80666a30
commit d7bdf0ae25
7 changed files with 32 additions and 39 deletions

View File

@@ -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