You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP

deep-eql

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
d

deep-eql

Improved deep equality testing for Node.js and the browser.

5.0.2
latest
100

Supply Chain Security

100

Vulnerability

98

Quality

76

Maintenance

100

License

Version published
Weekly downloads
22M
-4.13%
Maintainers
1
Weekly downloads
 
Created
Issues
21

What is deep-eql?

The deep-eql package is a deep equality testing library that allows developers to compare two values for structural equality, rather than just reference equality. It is useful for testing and assertions when you need to ensure that two complex objects, arrays, or other nested structures are equivalent in content.

What are deep-eql's main functionalities?

Deep Equality Check

This feature allows you to check if two objects are deeply equal, meaning their structure and nested values are equivalent.

const deepEql = require('deep-eql');
const obj1 = { a: 1, b: { c: 2 } };
const obj2 = { a: 1, b: { c: 2 } };
console.log(deepEql(obj1, obj2)); // true

Custom Type Comparisons

This feature allows you to provide a custom comparator function to define equality for specific types or instances.

const deepEql = require('deep-eql');
class Person {
  constructor(name) {
    this.name = name;
  }
}
const person1 = new Person('Alice');
const person2 = new Person('Alice');
console.log(deepEql(person1, person2, { comparator: (a, b) => a.name === b.name })); // true

Other packages similar to deep-eql

FAQs

Package last updated on 03 Jun 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