Skip to content

Commit a56c882

Browse files
authored
Fix Inefficient Regular Expression for setZoomMode (#3368)
1 parent a5f8fc9 commit a56c882

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/jspdf.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ function jsPDF(options) {
894894
"original"
895895
];
896896

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

0 commit comments

Comments
 (0)