mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 17:07:49 +00:00
Move internal modules to “internal” folder.
This commit is contained in:
22
.internal/createCompounder.js
Normal file
22
.internal/createCompounder.js
Normal file
@@ -0,0 +1,22 @@
|
||||
import arrayReduce from './.internal/arrayReduce.js';
|
||||
import deburr from './deburr.js';
|
||||
import words from './words.js';
|
||||
|
||||
/** Used to compose unicode capture groups. */
|
||||
const rsApos = "['\u2019]";
|
||||
|
||||
/** Used to match apostrophes. */
|
||||
const reApos = RegExp(rsApos, 'g');
|
||||
|
||||
/**
|
||||
* Creates a function like `camelCase`.
|
||||
*
|
||||
* @private
|
||||
* @param {Function} callback The function to combine each word.
|
||||
* @returns {Function} Returns the new compounder function.
|
||||
*/
|
||||
function createCompounder(callback) {
|
||||
return string => arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
|
||||
}
|
||||
|
||||
export default createCompounder;
|
||||
Reference in New Issue
Block a user