main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
633 bytes
|
Rev | Line | |
---|
[d565449] | 1 | import arrayReduce from './_arrayReduce.js';
|
---|
| 2 | import deburr from './deburr.js';
|
---|
| 3 | import words from './words.js';
|
---|
| 4 |
|
---|
| 5 | /** Used to compose unicode capture groups. */
|
---|
| 6 | var rsApos = "['\u2019]";
|
---|
| 7 |
|
---|
| 8 | /** Used to match apostrophes. */
|
---|
| 9 | var reApos = RegExp(rsApos, 'g');
|
---|
| 10 |
|
---|
| 11 | /**
|
---|
| 12 | * Creates a function like `_.camelCase`.
|
---|
| 13 | *
|
---|
| 14 | * @private
|
---|
| 15 | * @param {Function} callback The function to combine each word.
|
---|
| 16 | * @returns {Function} Returns the new compounder function.
|
---|
| 17 | */
|
---|
| 18 | function createCompounder(callback) {
|
---|
| 19 | return function(string) {
|
---|
| 20 | return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
|
---|
| 21 | };
|
---|
| 22 | }
|
---|
| 23 |
|
---|
| 24 | export default createCompounder;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.