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

tcompare

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tcompare

A comprehensive comparison library, for use in test frameworks

  • 9.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is tcompare?

The tcompare npm package is a tool for deep comparison of JavaScript objects. It is useful for testing and validation purposes, allowing developers to compare complex data structures and identify differences.

What are tcompare's main functionalities?

Deep Comparison

This feature allows for deep comparison of two objects. The code sample compares two nested objects and logs the differences.

const tcompare = require('tcompare');
const obj1 = { a: 1, b: { c: 2 } };
const obj2 = { a: 1, b: { c: 3 } };
const result = tcompare.compare(obj1, obj2);
console.log(result);

Custom Comparison

This feature allows for custom comparison logic. The code sample demonstrates how to use a custom comparison function to compare two objects.

const tcompare = require('tcompare');
const obj1 = { a: 1, b: 2 };
const obj2 = { a: 1, b: 3 };
const customCompare = (a, b) => a === b;
const result = tcompare.compare(obj1, obj2, { customCompare });
console.log(result);

Detailed Difference Reporting

This feature provides detailed reporting of differences between objects. The code sample shows how to access and log the differences between two objects.

const tcompare = require('tcompare');
const obj1 = { a: 1, b: { c: 2 } };
const obj2 = { a: 1, b: { c: 3 } };
const result = tcompare.compare(obj1, obj2);
console.log(result.diff);

Other packages similar to tcompare

Keywords

FAQs

Package last updated on 08 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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