MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / createCompounder

Function createCompounder

lib/web/jshint.js:4699–4711  ·  view source on GitHub ↗

* 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.

(callback)

Source from the content-addressed store, hash-verified

4697 * @returns {Function} Returns the new compounder function.
4698 */
4699 function createCompounder(callback) {
4700 return function(string) {
4701 var index = -1,
4702 array = words(deburr(string)),
4703 length = array.length,
4704 result = '';
4705
4706 while (++index < length) {
4707 result = callback(result, array[index], index);
4708 }
4709 return result;
4710 };
4711 }
4712
4713 /**
4714 * Creates a function that produces an instance of `Ctor` regardless of

Callers 1

runInContextFunction · 0.85

Calls 3

deburrFunction · 0.85
wordsFunction · 0.70
callbackFunction · 0.70

Tested by

no test coverage detected