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

is-shallow-equal

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-shallow-equal

Shallowly compares two objects

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
125K
increased by7.58%
Maintainers
1
Weekly downloads
 
Created

What is is-shallow-equal?

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.

What are is-shallow-equal's main functionalities?

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

Other packages similar to is-shallow-equal

Keywords

FAQs

Package last updated on 04 Oct 2017

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