Skip to content

Commit

Permalink
Addresses review comment
Browse files Browse the repository at this point in the history
  • Loading branch information
jreina committed Aug 24, 2020
1 parent d53a8b3 commit 0203b02
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/lorem.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@ var Lorem = function (faker) {
*/
self.word = function (length) {
var hasRightLength = function(word) { return word.length === length; };
var properLengthWords = typeof length == 'undefined'
? faker.definitions.lorem.words
: faker.definitions.lorem.words.filter(hasRightLength);
var properLengthWords;
if(typeof length === 'undefined') {
properLengthWords = faker.definitions.lorem.words;
} else {
properLengthWords = faker.definitions.lorem.words.filter(hasRightLength);
}
return faker.random.arrayElement(properLengthWords);
};

Expand Down

0 comments on commit 0203b02

Please sign in to comment.