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

looks-same

Package Overview
Dependencies
Maintainers
9
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 8.2.0 to 8.2.1

2

CHANGELOG.md

@@ -5,2 +5,4 @@ # Changelog

### [8.2.1](https://github.com/gemini-testing/looks-same/compare/v8.2.0...v8.2.1) (2023-08-02)
## [8.2.0](https://github.com/gemini-testing/looks-same/compare/v8.1.0...v8.2.0) (2023-08-02)

@@ -7,0 +9,0 @@

72

index.d.ts

@@ -45,21 +45,54 @@ // Type definitions for looks-same 5.0

/**
* The result obtained from the function.
*/
export interface LooksSameResult {
export interface DiffImage {
/**
* Width of the diff image
*/
width: number;
/**
* Height of the diff image
*/
height: number;
/**
* Save the diff image
* Path should be specified with image extension
*/
save: (path: string) => Promise<void>;
/**
* Create buffer of the diff image
* If you need to save the image, consider using `save` method
* Shoud not be mixed with `save` method
*/
createBuffer: (extension: "png" | "raw") => Promise<Buffer>;
}
interface LooksSameBaseResult {
/**
* true if images are equal, false - otherwise
*/
equal?: boolean;
equal: boolean;
/**
* diff bounds for not equal images
*/
diffBounds?: CoordBounds;
diffBounds: CoordBounds;
/**
* diff clusters for not equal images
*/
diffClusters?: CoordBounds[];
diffClusters: CoordBounds[];
}
interface LooksSameWithNoDiffResult extends LooksSameBaseResult {
equal: true;
diffImage: null;
}
interface LooksSameWithExistingDiffResult extends LooksSameBaseResult {
equal: false;
diffImage: DiffImage;
}
/**
* The result obtained from the function.
*/
export type LooksSameResult<T = false> = T extends true ? (LooksSameWithNoDiffResult | LooksSameWithExistingDiffResult) : LooksSameBaseResult;
/**
* The options passed to looksSame function

@@ -116,2 +149,6 @@ */

clustersSize?: number;
/**
* If you need both to compare images and create diff image
*/
createDiffImage?: boolean
}

@@ -253,19 +290,14 @@

* @param options The options passed to looksSame function
* @param callback Call when finish compare
*/
declare async function looksSame(
async function looksSame(
image1: string | Buffer | looksSame.BoundedImage,
image2: string | Buffer | looksSame.BoundedImage,
options: looksSame.LooksSameOptions | {}
): Promise<LooksSameResult>;
/**
* Compare two images
* @param image1 The first image
* @param image2 The second image
* @param callback Call when finish compare
*/
declare function looksSame(
options?: looksSame.LooksSameOptions & { createDiffImage?: false },
): Promise<looksSame.LooksSameResult<false>>;
async function looksSame(
image1: string | Buffer | looksSame.BoundedImage,
image2: string | Buffer | looksSame.BoundedImage
): Promise<LooksSameResult>;
image2: string | Buffer | looksSame.BoundedImage,
options: looksSame.LooksSameOptions & { createDiffImage: true },
): Promise<looksSame.LooksSameResult<true>>;

@@ -272,0 +304,0 @@ /**

{
"name": "looks-same",
"version": "8.2.0",
"version": "8.2.1",
"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