Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

looks-same

Package Overview
Dependencies
Maintainers
6
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

looks-same - npm Package Compare versions

Comparing version 5.0.1 to 5.0.2

lib/diff-area.js

26

index.js

@@ -16,20 +16,2 @@ 'use strict';

const getDiffArea = (diffPixelsCoords) => {
const xs = [];
const ys = [];
diffPixelsCoords.forEach((coords) => {
xs.push(coords[0]);
ys.push(coords[1]);
});
const top = _.min(ys);
const bottom = _.max(ys);
const left = _.min(xs);
const right = _.max(xs);
return {left, top, right, bottom};
};
const makeAntialiasingComparator = (comparator, png1, png2, opts) => {

@@ -179,5 +161,5 @@ const antialiasingComparator = new AntialiasingComparator(comparator, png1, png2, opts);

getDiffPixelsCoords(first, second, comparator, {stopOnFirstFail}, (result) => {
const diffBounds = getDiffArea(result);
const diffBounds = result.area;
callback(null, {equal: result.length === 0, diffBounds});
callback(null, {equal: result.isEmpty(), diffBounds});
});

@@ -210,7 +192,7 @@ });

getDiffPixelsCoords(first, second, comparator, opts, (result) => {
if (!result.length) {
if (result.isEmpty()) {
return callback(null, null);
}
callback(null, getDiffArea(result));
callback(null, result.area);
});

@@ -217,0 +199,0 @@ });

'use strict';
const DiffArea = require('./diff-area');
const png = require('../lib/png');

@@ -40,2 +42,3 @@

}
const stopOnFirstFail = opts.hasOwnProperty('stopOnFirstFail') ? opts.stopOnFirstFail : false;

@@ -46,3 +49,3 @@

const diffPixelsCoords = [];
const diffArea = new DiffArea();

@@ -63,6 +66,6 @@ const processRow = (y) => {

if (!result) {
diffPixelsCoords.push([x, y]);
diffArea.update(x, y);
if (stopOnFirstFail) {
return callback(diffPixelsCoords);
return callback(diffArea);
}

@@ -76,3 +79,3 @@ }

} else {
callback(diffPixelsCoords);
callback(diffArea);
}

@@ -79,0 +82,0 @@ });

{
"name": "looks-same",
"version": "5.0.1",
"version": "5.0.2",
"description": "Pure node.js library for comparing PNG-images, taking into account human color perception.",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc