Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@gilbarbara/deep-equal
Advanced tools
@gilbarbara/deep-equal is an npm package that provides functionality to deeply compare two JavaScript objects or values to determine if they are equivalent. It is useful for scenarios where a shallow comparison is insufficient, such as comparing nested objects or arrays.
Deep Comparison of Objects
This feature allows you to deeply compare two objects to check if they are equivalent. The code sample demonstrates comparing two nested objects.
const deepEqual = require('@gilbarbara/deep-equal');
const obj1 = { a: 1, b: { c: 2 } };
const obj2 = { a: 1, b: { c: 2 } };
console.log(deepEqual(obj1, obj2)); // true
Deep Comparison of Arrays
This feature allows you to deeply compare two arrays to check if they are equivalent. The code sample demonstrates comparing two nested arrays.
const deepEqual = require('@gilbarbara/deep-equal');
const arr1 = [1, [2, 3], 4];
const arr2 = [1, [2, 3], 4];
console.log(deepEqual(arr1, arr2)); // true
Deep Comparison of Mixed Types
This feature allows you to deeply compare mixed types, such as objects containing arrays and other objects. The code sample demonstrates comparing two complex nested structures.
const deepEqual = require('@gilbarbara/deep-equal');
const mixed1 = { a: [1, 2, { b: 3 }] };
const mixed2 = { a: [1, 2, { b: 3 }] };
console.log(deepEqual(mixed1, mixed2)); // true
The 'deep-equal' package is a popular alternative for deep comparison of JavaScript objects and values. It provides similar functionality to @gilbarbara/deep-equal but is more widely used and has a larger community.
The 'lodash.isequal' package is part of the Lodash library and offers deep comparison functionality. It is highly optimized and well-maintained, making it a reliable choice for deep equality checks.
The 'fast-deep-equal' package is known for its performance and small size. It provides deep comparison functionality with a focus on speed, making it suitable for performance-critical applications.
Lightweight deep equal comparator.
npm i @gilbarbara/deep-equal
import equal from '@gilbarbara/deep-equal';
equal({ a: 1 }, { a: 1 }); // true
Inspired by fast-deep-equal package. Thanks! ❤️
MIT
FAQs
Tiny deep equal comparator
We found that @gilbarbara/deep-equal demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.