From 2907c27ca9cf3657188470094a689decda3df65a Mon Sep 17 00:00:00 2001 From: Marak Date: Sat, 4 Jul 2015 23:42:43 -0700 Subject: [api] [fix] Remove tabs from paragraph generation. Make paragraph separator configurable. Closes #223 --- lib/lorem.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'lib') diff --git a/lib/lorem.js b/lib/lorem.js index aaea46f9..eb4d72d5 100644 --- a/lib/lorem.js +++ b/lib/lorem.js @@ -21,7 +21,7 @@ var lorem = { if (typeof sentenceCount == 'undefined') { sentenceCount = 3; } var sentences = []; for (sentenceCount; sentenceCount > 0; sentenceCount--) { - sentences.push(faker.lorem.sentence()); + sentences.push(faker.lorem.sentence()); } return sentences.join("\n"); }, @@ -31,13 +31,16 @@ var lorem = { return faker.lorem.sentences(sentenceCount + faker.random.number(3)); }, - paragraphs: function (paragraphCount) { - if (typeof paragraphCount == 'undefined') { paragraphCount = 3; } - var paragraphs = []; - for (paragraphCount; paragraphCount > 0; paragraphCount--) { - paragraphs.push(faker.lorem.paragraph()); - } - return paragraphs.join("\n \r\t"); + paragraphs: function (paragraphCount, separator) { + if (typeof separator === "undefined") { + separator = "\n \r"; + } + if (typeof paragraphCount == 'undefined') { paragraphCount = 3; } + var paragraphs = []; + for (paragraphCount; paragraphCount > 0; paragraphCount--) { + paragraphs.push(faker.lorem.paragraph()); + } + return paragraphs.join(separator); } }; -- cgit v1.2.3