diff options
| author | Matthew Bergman <[email protected]> | 2010-05-15 03:20:52 -0400 |
|---|---|---|
| committer | Matthew Bergman <[email protected]> | 2010-05-15 03:20:52 -0400 |
| commit | ab73c5fe63895cc01481c017e1752cfbf4786f3b (patch) | |
| tree | 243b865b081de62adfa75785d0dc30365223115b /lib | |
| parent | c6dbabb8689a50754d80693250845efb31c81f68 (diff) | |
| download | faker-ab73c5fe63895cc01481c017e1752cfbf4786f3b.tar.xz faker-ab73c5fe63895cc01481c017e1752cfbf4786f3b.zip | |
lorem done
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/lorem.js | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/lib/lorem.js b/lib/lorem.js index 93f7b600..7ba1b118 100644 --- a/lib/lorem.js +++ b/lib/lorem.js @@ -16,26 +16,26 @@ exports.sentence = function(wordCount){ exports.sentences = function(sentenceCount){ if( typeof sentenceCount == 'undefined'){ var sentenceCount = 3;} - var sentences = ""; + var sentences = []; for(sentenceCount; sentenceCount >= 0; sentenceCount--){ - sentences = sentences + this.sentence(); + sentences.push(this.sentence()); } - return sentences; -} + return sentences.join("\n"); +}; -function paragraph(sentence_count){ - return 'paragraph'; - //sentences(sentence_count + rand(3)).join(' ') -} +exports.paragraph = function(sentenceCount){ + if( typeof sentenceCount == 'undefined'){ var sentenceCount = 3;} + return this.sentences(sentenceCount + Helper.randomNumber(3)); +}; -function paragraphs(paragraph_count){ - return 'paragraphs'; - /* - returning([]) do |paragraphs| - 1.upto(paragraph_count) do - paragraphs << paragraph - */ -} +exports.sentences = function(paragraphCount){ + if( typeof paragraphCount == 'undefined'){ var paragraphCount = 3;} + var paragraphs = []; + for(paragraphCount; paragraphCount >= 0; paragraphCount--){ + paragraphs.push(this.sentence()); + } + return paragraphs.join("\n \r\t"); +}; String.prototype.capitalize = function(){ //v1.0 return this.replace(/\w+/g, function(a){ |
