From 7f75569cbff1f41739b1ff309503c86f4727aa7a Mon Sep 17 00:00:00 2001 From: DimitarChristoff Date: Thu, 30 Aug 2012 18:34:40 +0100 Subject: massive refactor of all sub modules and rebuild to remove syntax errors and jshint issues --- lib/lorem.js | 62 +++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 26 deletions(-) (limited to 'lib/lorem.js') diff --git a/lib/lorem.js b/lib/lorem.js index 8a408ec2..64b77025 100644 --- a/lib/lorem.js +++ b/lib/lorem.js @@ -1,40 +1,50 @@ var Helpers = require('./helpers'); var definitions = require('../lib/definitions'); -exports.words = function(num){ - if( typeof num == 'undefined'){ var num = 3;} - return Helpers.shuffle(definitions.lorem()).slice(0, num); - //Words.shuffle[0, num] +exports.words = function(num) { + if (typeof num == 'undefined') { + num = 3; + } + return Helpers.shuffle(definitions.lorem()).slice(0, num); + //Words.shuffle[0, num] }; -exports.sentence = function(wordCount){ - if( typeof wordCount == 'undefined'){ var wordCount = 3;} +exports.sentence = function(wordCount) { + if (typeof wordCount == 'undefined') { + wordCount = 3; + } - // strange issue with the node_min_test failing for captialize, please fix and add this back - //return this.words(wordCount + Helpers.randomNumber(7)).join(' ').capitalize(); + // strange issue with the node_min_test failing for captialize, please fix and add this back + //return this.words(wordCount + Helpers.randomNumber(7)).join(' ').capitalize(); - return this.words(wordCount + Helpers.randomNumber(7)).join(' '); + return this.words(wordCount + Helpers.randomNumber(7)).join(' '); }; -exports.sentences = function(sentenceCount){ - if( typeof sentenceCount == 'undefined'){ var sentenceCount = 3;} - var sentences = []; - for(sentenceCount; sentenceCount >= 0; sentenceCount--){ - sentences.push(this.sentence()); - } - return sentences.join("\n"); +exports.sentences = function(sentenceCount) { + if (typeof sentenceCount == 'undefined') { + sentenceCount = 3; + } + var sentences = []; + for (sentenceCount; sentenceCount >= 0; sentenceCount--) { + sentences.push(this.sentence()); + } + return sentences.join("\n"); }; -exports.paragraph = function(sentenceCount){ - if( typeof sentenceCount == 'undefined'){ var sentenceCount = 3;} - return this.sentences(sentenceCount + Helpers.randomNumber(3)); +exports.paragraph = function(sentenceCount) { + if (typeof sentenceCount == 'undefined') { + sentenceCount = 3; + } + return this.sentences(sentenceCount + Helpers.randomNumber(3)); }; -exports.paragraphs = function(paragraphCount){ - if( typeof paragraphCount == 'undefined'){ var paragraphCount = 3;} - var paragraphs = []; - for(paragraphCount; paragraphCount >= 0; paragraphCount--){ - paragraphs.push(this.paragraph()); - } - return paragraphs.join("\n \r\t"); +exports.paragraphs = function(paragraphCount) { + if (typeof paragraphCount == 'undefined') { + paragraphCount = 3; + } + var paragraphs = []; + for (paragraphCount; paragraphCount >= 0; paragraphCount--) { + paragraphs.push(this.paragraph()); + } + return paragraphs.join("\n \r\t"); }; -- cgit v1.2.3