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,5 +1,5 @@
import createCompounder from './.internal/createCompounder.js'
import upperFirst from './upperFirst.js'
import words from './words.js'
/**
* Converts `string` to
@@ -21,8 +21,10 @@ import upperFirst from './upperFirst.js'
* startCase('__FOO_BAR__')
* // => 'FOO BAR'
*/
const startCase = createCompounder((result, word, index) =>
result + (index ? ' ' : '') + upperFirst(word)
const startCase = (string) => (
words(`${ string }`.replace(/['\u2019]/g, '')).reduce((result, word, index) => (
result + (index ? ' ' : '') + upperFirst(word)
), '')
)
export default startCase