looks-same icon indicating copy to clipboard operation
looks-same copied to clipboard

`looksSame` throws an error when an error is present using the readme code

Open vctr-dev opened this issue 6 years ago • 2 comments

looksSame throws an error when an error is present, using the readme code

looksSame('image1.png', 'image2.png', function(error, {equal}) {
    // equal will be true, if images looks the same
});

> TypeError: Cannot destructure property `equal` of 'undefined' or 'null'.

Should probably update the docs to set the default in the callback i.e.

looksSame('image1.png', 'image2.png', function(error, {equal} = {}) {
    // equal will be true, if images looks the same
});

vctr-dev avatar Aug 21 '19 00:08 vctr-dev

This doesn't resolve the error, this just makes it not stop the script. Equal still comes out as undefined.

Pathos14489 avatar Jul 07 '20 00:07 Pathos14489

After some more fidgeting, I figured out the issue. looks-same only works on .png images.

Pathos14489 avatar Jul 07 '20 01:07 Pathos14489