verb
Version:
A project without documentation is like a project that doesn't exist. Verb solves this by making it dead simple to generate docs, using simple markdown templates, with zero configuration required.
16 lines (15 loc) • 350 B
JavaScript
/**
* Strip newlines and whitespace padding.
*
* @name reverse
* @param {String} str The string to reverse
* @return {String} The reversed string.
* @api public
*/
module.exports = function(str) {
str = str || '';
str = str.replace(/^\s+/gm, '');
str = str.replace(/\s+$/gm, '');
str = str.replace(/\n+/gm, ' ');
return str;
};