Skip to content

Commit

Permalink
lorem done
Browse files Browse the repository at this point in the history
  • Loading branch information
FotoVerite committed May 15, 2010
1 parent c6dbabb commit ab73c5f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ sys.puts(JSON.stringify(Faker.Company.bs()));
sys.puts(JSON.stringify(Faker.Lorem.words()));
sys.puts(JSON.stringify(Faker.Lorem.sentence()));
sys.puts(JSON.stringify(Faker.Lorem.sentences()));
sys.puts(JSON.stringify(Faker.Lorem.paragraph()));




Expand Down
32 changes: 16 additions & 16 deletions lib/lorem.js
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down

0 comments on commit ab73c5f

Please sign in to comment.