diff options
Diffstat (limited to 'tools/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/createCompounder.js')
-rw-r--r-- | tools/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/createCompounder.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tools/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/createCompounder.js b/tools/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/createCompounder.js new file mode 100644 index 0000000000..4c755120c6 --- /dev/null +++ b/tools/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/createCompounder.js @@ -0,0 +1,26 @@ +var deburr = require('../string/deburr'), + words = require('../string/words'); + +/** + * Creates a function that produces compound words out of the words in a + * given string. + * + * @private + * @param {Function} callback The function to combine each word. + * @returns {Function} Returns the new compounder function. + */ +function createCompounder(callback) { + return function(string) { + var index = -1, + array = words(deburr(string)), + length = array.length, + result = ''; + + while (++index < length) { + result = callback(result, array[index], index); + } + return result; + }; +} + +module.exports = createCompounder; |