Sha256: c2973a4253b5ea5ff6d1868606e8d3e613dd6945dabb0e2e5d877090cef3f929
Contents?: true
Size: 652 Bytes
Versions: 167
Compression:
Stored size: 652 Bytes
Contents
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;
Version data entries
167 entries across 87 versions & 9 rubygems