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.
is-shallow-equal
Advanced tools
The is-shallow-equal npm package is a utility for performing shallow equality checks between two values. It is useful for determining if two objects or arrays are equal by comparing their properties or elements at the first level.
Shallow Equality Check for Objects
This feature allows you to check if two objects are shallowly equal. It compares the properties of the objects at the first level.
const isShallowEqual = require('is-shallow-equal');
const obj1 = { a: 1, b: 2 };
const obj2 = { a: 1, b: 2 };
const result = isShallowEqual(obj1, obj2);
console.log(result); // true
Shallow Equality Check for Arrays
This feature allows you to check if two arrays are shallowly equal. It compares the elements of the arrays at the first level.
const isShallowEqual = require('is-shallow-equal');
const arr1 = [1, 2, 3];
const arr2 = [1, 2, 3];
const result = isShallowEqual(arr1, arr2);
console.log(result); // true
Shallow Equality Check for Mixed Types
This feature allows you to check shallow equality between different types, such as an object and an array. It will return false if the types are different.
const isShallowEqual = require('is-shallow-equal');
const obj = { a: 1, b: 2 };
const arr = [1, 2];
const result = isShallowEqual(obj, arr);
console.log(result); // false
The shallowequal package provides similar functionality for performing shallow equality checks. It compares objects and arrays at the first level, just like is-shallow-equal. However, shallowequal is more widely used and has more frequent updates.
The lodash.isequal package is part of the Lodash library and provides deep equality checks. While it can perform shallow checks, its primary use case is for deep comparisons, making it more versatile but potentially more complex than is-shallow-equal.
The fast-deep-equal package is designed for deep equality checks but can also be used for shallow comparisons. It is optimized for performance and is a good alternative if you need both shallow and deep equality checks.
Shallowly compares two objects
$ npm install --save is-shallow-equal
var isSquallowEqual = isShallowEqual(a, b)
$ npm run test
FAQs
Shallowly compares two objects
The npm package is-shallow-equal receives a total of 104,663 weekly downloads. As such, is-shallow-equal popularity was classified as popular.
We found that is-shallow-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.