From cffc3cc2b1aeb3be7796086fdabd4571d8e38549 Mon Sep 17 00:00:00 2001 From: Amine Ben hammou Date: Tue, 5 Jun 2018 10:28:54 +0000 Subject: [PATCH] limit regexp repetitions to max of 5 --- src/generate.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/generate.js b/src/generate.js index 99039f5..3429931 100644 --- a/src/generate.js +++ b/src/generate.js @@ -8,8 +8,10 @@ const string = def('generateString', {}, [T.StringSchema, $.String], ({choices, match, minLength, maxLength}) => { if (choices) match = choices.map(escapeStringRegexp).join('|') - if (match) + if (match) { + match.max = 5 return randexp(match) + } const length = chance.integer({min: minLength, max: maxLength}) return chance.string({length}) }