New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

pam-diff

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pam-diff - npm Package Compare versions

Comparing version 0.5.0 to 0.7.0

45

index.js

@@ -18,3 +18,2 @@ // jshint esversion: 6, globalstrict: true, strict: true

this._parseChunk = this._parseFirstChunk;//first parsing will be reading settings and configuring internal pixel reading
//todo add option for break on first region so that pixel is not measured in multiple overlapping regions
}

@@ -75,3 +74,3 @@

polygon: polygonPoints,
pointsLength: polygonPoints.pointsLength(),
pointsLength: polygonPoints.pointsLength,
difference: this._validateNumber(parseInt(region.difference), this._difference, 1, 255),

@@ -140,13 +139,11 @@ percent: this._validateNumber(parseInt(region.percent), this._percent, 1, 100),

for (let x = 0; x < this._width; x++, i++) {
const diff = this._oldPix[i] !== this._newPix[i];
if (this._regions) {
for (let j = 0; j < this._regionsLength; j++) {
if (this._regions[j].polygon.containsPoint({x: x, y: y}) === true) {
if (this._oldPix[i] !== this._newPix[i]) {
if (diff === true && this._regions[j].polygon.containsPoint({x: x, y: y}) === true) {
this._regions[j].diffs++;
}
break;//todo add option for break on first region
}
}
} else {
if (this._oldPix[i] !== this._newPix[i]) {
if (diff === true) {
this._diffs++;

@@ -183,13 +180,11 @@ }

for (let x = 0; x < this._width; x++, i++) {
const diff = Math.abs(this._oldPix[i] - this._newPix[i]);
if (this._regions) {
for (let j = 0; j < this._regionsLength; j++) {
if (this._regions[j].polygon.containsPoint({x: x, y: y}) === true) {
if (Math.abs(this._oldPix[i] - this._newPix[i]) >= this._regions[j].difference) {
this._regions[j].diffs++;
}
break;//todo add option for break on first region
if (diff >= this._regions[j].difference && this._regions[j].polygon.containsPoint({x: x, y: y}) === true) {
this._regions[j].diffs++;
}
}
} else {
if (Math.abs(this._oldPix[i] - this._newPix[i]) >= this._difference) {
if (diff >= this._difference) {
this._diffs++;

@@ -226,13 +221,12 @@ }

for (let x = 0; x < this._width; x++, i += 3) {
const diff = Math.abs( this._grayscale(this._oldPix[i], this._oldPix[i + 1], this._oldPix[i + 2]) - this._grayscale(this._newPix[i], this._newPix[i + 1], this._newPix[i + 2]) );
if (this._regions) {
for (let j = 0; j < this._regionsLength; j++) {
if (this._regions[j].polygon.containsPoint({x: x, y: y}) === true) {
if (Math.abs(this._grayscale(this._oldPix[i], this._oldPix[i + 1], this._oldPix[i + 2]) - this._grayscale(this._newPix[i], this._newPix[i + 1], this._newPix[i + 2])) >= this._regions[j].difference) {
this._regions[j].diffs++;
}
break;//todo add option for break on first region
if (diff >= this._regions[j].difference && this._regions[j].polygon.containsPoint({x: x, y: y}) === true) {
this._regions[j].diffs++;
//break;
}
}
} else {
if (Math.abs(this._grayscale(this._oldPix[i], this._oldPix[i + 1], this._oldPix[i + 2]) - this._grayscale(this._newPix[i], this._newPix[i + 1], this._newPix[i + 2])) >= this._difference) {
if (diff >= this._difference) {
this._diffs++;

@@ -269,13 +263,11 @@ }

for (let x = 0; x < this._width; x++, i += 4) {
const diff = Math.abs( this._grayscale(this._oldPix[i], this._oldPix[i + 1], this._oldPix[i + 2]) - this._grayscale(this._newPix[i], this._newPix[i + 1], this._newPix[i + 2]) );
if (this._regions) {
for (let j = 0; j < this._regionsLength; j++) {
if (this._regions[j].polygon.containsPoint({x: x, y: y}) === true) {
if (Math.abs(this._grayscale(this._oldPix[i], this._oldPix[i + 1], this._oldPix[i + 2]) - this._grayscale(this._newPix[i], this._newPix[i + 1], this._newPix[i + 2])) >= this._regions[j].difference) {
this._regions[j].diffs++;
}
break;//todo add option for break on first region
if (diff >= this._regions[j].difference && this._regions[j].polygon.containsPoint({x: x, y: y}) === true) {
this._regions[j].diffs++;
}
}
} else {
if (Math.abs(this._grayscale(this._oldPix[i], this._oldPix[i + 1], this._oldPix[i + 2]) - this._grayscale(this._newPix[i], this._newPix[i + 1], this._newPix[i + 2])) >= this._difference) {
if (diff >= this._difference) {
this._diffs++;

@@ -348,2 +340,3 @@ }

module.exports = PamDiff;
//todo get bounding box of all regions combined to exclude some pixels before checking if they exist inside specific regions
//todo get bounding box of all regions combined to exclude some pixels before checking if they exist inside specific regions
//todo add option for break on first region so that pixel is not measured in multiple overlapping regions
{
"name": "pam-diff",
"version": "0.5.0",
"version": "0.7.0",
"description": "Measure differences between pixel arrays extracted from pam images",

@@ -30,7 +30,7 @@ "main": "index.js",

"dependencies": {
"polygon-points": "^0.2.0"
"polygon-points": "^0.3.0"
},
"devDependencies": {
"pipe2pam": "^0.5.0"
"pipe2pam": "^0.6.0"
}
}
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