🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@wordpress/is-shallow-equal

Package Overview
Dependencies
Maintainers
23
Versions
164
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wordpress/is-shallow-equal

Test for shallow equality between two objects or arrays.

5.26.0
latest
Source
npm
Version published
Weekly downloads
153K
-27.57%
Maintainers
23
Weekly downloads
 
Created

What is @wordpress/is-shallow-equal?

@wordpress/is-shallow-equal is a utility package used to perform shallow equality checks between two values. It is commonly used in scenarios where you need to determine if two objects or arrays are equivalent in terms of their immediate properties or elements, without performing a deep comparison.

What are @wordpress/is-shallow-equal's main functionalities?

Shallow Equality Check for Objects

This feature allows you to check if two objects are shallowly equal, meaning their properties are the same and have the same values. The code sample demonstrates how to use the package to compare two objects.

const isShallowEqual = require('@wordpress/is-shallow-equal');

const obj1 = { a: 1, b: 2 };
const obj2 = { a: 1, b: 2 };
const obj3 = { a: 1, b: 3 };

console.log(isShallowEqual(obj1, obj2)); // true
console.log(isShallowEqual(obj1, obj3)); // false

Shallow Equality Check for Arrays

This feature allows you to check if two arrays are shallowly equal, meaning they contain the same elements in the same order. The code sample demonstrates how to use the package to compare two arrays.

const isShallowEqual = require('@wordpress/is-shallow-equal');

const arr1 = [1, 2, 3];
const arr2 = [1, 2, 3];
const arr3 = [1, 2, 4];

console.log(isShallowEqual(arr1, arr2)); // true
console.log(isShallowEqual(arr1, arr3)); // false

Other packages similar to @wordpress/is-shallow-equal

Keywords

wordpress

FAQs

Package last updated on 25 Jun 2025

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