Skip to content

Commit

Permalink
chore: fix potential regex issue
Browse files Browse the repository at this point in the history
  • Loading branch information
edvardchen committed May 30, 2023
1 parent 77f560c commit 6447dbb
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/helper/generateFullMatchRegExp.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ module.exports = function generateFullMatchRegExp(source) {
return source;
}
if (typeof source !== 'string') {
console.error('generateFullMatchRegExp: expect string but get', source);
return new RegExp();
throw new Error('generateFullMatchRegExp: expect string but get', source);
}
// allow dot ahead
return new RegExp(`(^|\\.)${source}${source.endsWith('$') ? '' : '$'}`);
Expand Down

0 comments on commit 6447dbb

Please sign in to comment.