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

@wordpress/is-shallow-equal

Package Overview
Dependencies
Maintainers
25
Versions
151
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.

  • 4.19.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
127K
increased by5.57%
Maintainers
25
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

FAQs

Package last updated on 05 Oct 2022

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