Skip to content

Commit

Permalink
fix to 'Should call randomWord with regex'
Browse files Browse the repository at this point in the history
  • Loading branch information
dhowe committed Nov 17, 2023
1 parent 89dcd1d commit 6cf2e12
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/lexicon.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ class Lexicon {
opts.minDistance = opts.minDistance || 1;
opts.numSyllables = opts.numSyllables || 0;
opts.maxLength = opts.maxLength || Number.MAX_SAFE_INTEGER;
opts.minLength = opts.minLength || 3;//(opts.limit > 1 ? 3 : 4); // 4 for randomWord
opts.minLength = opts.minLength || opts.limit > 1 ? 3 : 4; // 4 for randomWord

if (typeof opts.limit !== 'number' || opts.limit < 1) {
opts.limit = Number.MAX_SAFE_INTEGER;
Expand Down
2 changes: 1 addition & 1 deletion test/dist/lexicon-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ describe("Lexicon", function() {
expect(results.length > 1).to.be.true;
result = RiTa.randomWord(/^a/);
expect(/^a/.test(result)).to.be.true;
expect(result.length > 3).to.be.true;
expect(result.length >= 3).to.be.true;
result = RiTa.randomWord(/^apple$/);
expect(result).equal("apple");
result = RiTa.randomWord(/le/);
Expand Down

0 comments on commit 6cf2e12

Please sign in to comment.