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

@probe.gl/test-utils

Package Overview
Dependencies
Maintainers
6
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@probe.gl/test-utils - npm Package Compare versions

Comparing version 3.2.0 to 3.2.1

polyfill.js

21

dist/es5/utils/diff-images.js

@@ -55,3 +55,5 @@ "use strict";

_options$includeAA = options.includeAA,
includeAA = _options$includeAA === void 0 ? false : _options$includeAA;
includeAA = _options$includeAA === void 0 ? false : _options$includeAA,
_options$includeEmpty = options.includeEmpty,
includeEmpty = _options$includeEmpty === void 0 ? true : _options$includeEmpty;
var diffImage = createDiffImage ? new Uint8Array(width * height) : null;

@@ -62,3 +64,4 @@ var mismatchedPixels = (0, _pixelmatch["default"])(image1.data, image2.data, diffImage, width, height, {

});
var match = 1 - mismatchedPixels / (width * height);
var pixelCount = includeEmpty ? width * height : countNonEmptyPixels(image1.data, image2.data);
var match = 1 - mismatchedPixels / pixelCount;
return {

@@ -72,2 +75,16 @@ match: match,

function countNonEmptyPixels(data1, data2) {
var pixels1 = new Uint8Array(data1.buffer);
var pixels2 = new Uint8Array(data2.buffer);
var count = 0;
for (var i = 3; i < pixels1.length; i += 4) {
if (pixels1[i] > 0 || pixels2[i] > 0) {
count++;
}
}
return count;
}
function parsePNG(source) {

@@ -74,0 +91,0 @@ var image = new _pngjs.PNG();

@@ -29,3 +29,4 @@ import fs from 'fs';

tolerance = 0.1,
includeAA = false
includeAA = false,
includeEmpty = true
} = options;

@@ -37,3 +38,4 @@ const diffImage = createDiffImage ? new Uint8Array(width * height) : null;

});
const match = 1 - mismatchedPixels / (width * height);
const pixelCount = includeEmpty ? width * height : countNonEmptyPixels(image1.data, image2.data);
const match = 1 - mismatchedPixels / pixelCount;
return {

@@ -47,2 +49,16 @@ match,

function countNonEmptyPixels(data1, data2) {
const pixels1 = new Uint8Array(data1.buffer);
const pixels2 = new Uint8Array(data2.buffer);
let count = 0;
for (let i = 3; i < pixels1.length; i += 4) {
if (pixels1[i] > 0 || pixels2[i] > 0) {
count++;
}
}
return count;
}
function parsePNG(source) {

@@ -49,0 +65,0 @@ const image = new PNG();

@@ -42,3 +42,5 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";

_options$includeAA = options.includeAA,
includeAA = _options$includeAA === void 0 ? false : _options$includeAA;
includeAA = _options$includeAA === void 0 ? false : _options$includeAA,
_options$includeEmpty = options.includeEmpty,
includeEmpty = _options$includeEmpty === void 0 ? true : _options$includeEmpty;
var diffImage = createDiffImage ? new Uint8Array(width * height) : null;

@@ -49,3 +51,4 @@ var mismatchedPixels = pixelmatch(image1.data, image2.data, diffImage, width, height, {

});
var match = 1 - mismatchedPixels / (width * height);
var pixelCount = includeEmpty ? width * height : countNonEmptyPixels(image1.data, image2.data);
var match = 1 - mismatchedPixels / pixelCount;
return {

@@ -59,2 +62,16 @@ match: match,

function countNonEmptyPixels(data1, data2) {
var pixels1 = new Uint8Array(data1.buffer);
var pixels2 = new Uint8Array(data2.buffer);
var count = 0;
for (var i = 3; i < pixels1.length; i += 4) {
if (pixels1[i] > 0 || pixels2[i] > 0) {
count++;
}
}
return count;
}
function parsePNG(source) {

@@ -61,0 +78,0 @@ var image = new PNG();

9

package.json

@@ -5,3 +5,3 @@ {

"license": "MIT",
"version": "3.2.0",
"version": "3.2.1",
"keywords": [

@@ -20,3 +20,4 @@ "integration test",

"dist",
"src"
"src",
"polyfill.js"
],

@@ -31,6 +32,6 @@ "browser": {

"pixelmatch": "^4.0.2",
"probe.gl": "3.2.0",
"probe.gl": "3.2.1",
"puppeteer": "^1.16.0"
},
"gitHead": "f4b7ecb54a8c3eeac314307762d84b909f2e90c1"
"gitHead": "33d2a2efbb1b63fb46867bcd14df287bcacc114a"
}

@@ -21,3 +21,2 @@ // Copyright (c) 2015 - 2017 Uber Technologies, Inc.

/* global process, setTimeout, clearTimeout */
import puppeteer from 'puppeteer';

@@ -24,0 +23,0 @@ import ChildProcess from 'child_process';

@@ -20,3 +20,2 @@ // Copyright (c) 2015 - 2017 Uber Technologies, Inc.

// THE SOFTWARE.
/* global console */
import BrowserDriver from './browser-driver';

@@ -23,0 +22,0 @@ import {COLOR, addColor} from 'probe.gl';

@@ -1,2 +0,1 @@

/* global Buffer */
import fs from 'fs';

@@ -28,3 +27,9 @@ import {PNG} from 'pngjs';

const {threshold = 0.99, createDiffImage = false, tolerance = 0.1, includeAA = false} = options;
const {
threshold = 0.99,
createDiffImage = false,
tolerance = 0.1,
includeAA = false,
includeEmpty = true
} = options;

@@ -43,4 +48,6 @@ const diffImage = createDiffImage ? new Uint8Array(width * height) : null;

const match = 1 - mismatchedPixels / (width * height);
const pixelCount = includeEmpty ? width * height : countNonEmptyPixels(image1.data, image2.data);
const match = 1 - mismatchedPixels / pixelCount;
return {

@@ -54,2 +61,15 @@ match,

function countNonEmptyPixels(data1, data2) {
const pixels1 = new Uint8Array(data1.buffer);
const pixels2 = new Uint8Array(data2.buffer);
let count = 0;
for (let i = 3; i < pixels1.length; i += 4) {
// Exclude a pixel if it's empty in both images
if (pixels1[i] > 0 || pixels2[i] > 0) {
count++;
}
}
return count;
}
// TODO - replace pngjs with @loaders.gl/images

@@ -56,0 +76,0 @@ function parsePNG(source) {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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