diff options
| author | Marak <[email protected]> | 2015-07-04 23:42:43 -0700 |
|---|---|---|
| committer | Marak <[email protected]> | 2015-07-04 23:42:43 -0700 |
| commit | 2907c27ca9cf3657188470094a689decda3df65a (patch) | |
| tree | 9ea4717ea4196a86582474e48c4094f68cb10c7d /lib | |
| parent | 846e3812575b700c3d930463a3bf47c8fd968097 (diff) | |
| download | faker-2907c27ca9cf3657188470094a689decda3df65a.tar.xz faker-2907c27ca9cf3657188470094a689decda3df65a.zip | |
[api] [fix] Remove tabs from paragraph generation. Make paragraph separator configurable. Closes #223
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/lorem.js | 19 |
1 files changed, 11 insertions, 8 deletions
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); } }; |
