Skip to content

Commit

Permalink
Fix Inefficient Regular Expression for setZoomMode (#3368)
Browse files Browse the repository at this point in the history
  • Loading branch information
yetingli authored Jan 28, 2022
1 parent a5f8fc9 commit a56c882
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/jspdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ function jsPDF(options) {
"original"
];

if (/^\d*\.?\d*%$/.test(zoom)) {
if (/^(?:\d+\.\d*|\d*\.\d+|\d+)%$/.test(zoom)) {
zoomMode = zoom;
} else if (!isNaN(zoom)) {
zoomMode = parseInt(zoom, 10);
Expand Down

0 comments on commit a56c882

Please sign in to comment.