diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/lorem.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/lorem.js b/lib/lorem.js index db6aec72..d344de15 100644 --- a/lib/lorem.js +++ b/lib/lorem.js @@ -11,10 +11,11 @@ var Lorem = function (faker) { * word * * @method faker.lorem.word - * @param {number} num + * @param {number} length */ - self.word = function (num) { - return faker.random.arrayElement(faker.definitions.lorem.words); + self.word = function (length) { + var properLengthWords = faker.definitions.lorem.words.filter(function(word) { return word.length === num; }); + return faker.random.arrayElement(properLengthWords); }; /** |
