Skip to content

Commit 3096ee9

Browse files
author
VendorMap
committed
Changed errors to use template literals instead of string concatenation. Removed pnpm-lock. Output the sizes of image 1 and 2 in the case they are different as well
1 parent b88143a commit 3096ee9

2 files changed

Lines changed: 2 additions & 738 deletions

File tree

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ export default function pixelmatch(img1, img2, output, width, height, options =
3131
throw new Error('Image data: Uint8Array, Uint8ClampedArray or Buffer expected.');
3232

3333
if (img1.length !== img2.length || (output && output.length !== img1.length))
34-
throw new Error('Image sizes do not match.');
34+
throw new Error(`Image sizes do not match. Image 1 size: ${img1.length}, image 2 size: ${img2.length}`);
3535

36-
if (img1.length !== width * height * 4) throw new Error('Image data size does not match width/height. Expecting ' + width * height * 4 + '. Got ' + img1.length);
36+
if (img1.length !== width * height * 4) throw new Error(`Image data size does not match width/height. Expecting ${width * height * 4}. Got ${img1.length}`);
3737

3838
// check if images are identical
3939
const len = width * height;

0 commit comments

Comments
 (0)