Skip to content

Commit f4edf3d

Browse files
committed
Do not assign match variable on condition check
1 parent 54e6600 commit f4edf3d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/image.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ class PDFImage {
1515
} else if (src instanceof ArrayBuffer) {
1616
data = Buffer.from(new Uint8Array(src));
1717
} else {
18-
let match;
19-
if ((match = /^data:.+?;base64,(.*)$/.exec(src))) {
18+
const match = /^data:.+?;base64,(.*)$/.exec(src);
19+
if (match) {
2020
data = Buffer.from(match[1], 'base64');
2121
} else {
2222
data = fs.readFileSync(src);

lib/mixins/attachments.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ export default {
3333
} else if (src instanceof ArrayBuffer) {
3434
data = Buffer.from(new Uint8Array(src));
3535
} else {
36-
let match;
37-
if ((match = /^data:(.*?);base64,(.*)$/.exec(src))) {
36+
const match = /^data:(.*?);base64,(.*)$/.exec(src);
37+
if (match) {
3838
if (match[1]) {
3939
refBody.Subtype = match[1].replace('/', '#2F');
4040
}

0 commit comments

Comments
 (0)