Socket
Socket
Sign inDemoInstall

deep-is

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

deep-is

node's assert.deepEqual algorithm except for NaN being equal to NaN


Version published
Maintainers
1
Weekly downloads
33,464,998
increased by4.33%

Weekly downloads

Package description

What is deep-is?

The deep-is npm package provides a utility function for performing deep equality checks between two values. It can be used to determine if two objects, arrays, or other nested structures have the same content, regardless of whether they are the same reference in memory.

What are deep-is's main functionalities?

Deep Equality Check

This feature allows you to compare two complex objects or arrays to determine if they are deeply equal, meaning that their structure and values are the same, even if they are different instances in memory.

var deepEqual = require('deep-is');
console.log(deepEqual({ a: 1, b: { c: 1 } }, { a: 1, b: { c: 1 } })); // true
console.log(deepEqual([1, 2, [3, 4]], [1, 2, [3, 4]])); // true
console.log(deepEqual({ a: 1, b: { c: 1 } }, { a: 1, b: { c: 2 } })); // false

Other packages similar to deep-is

Readme

Source

deep-is

Node's assert.deepEqual() algorithm as a standalone module. Exactly like deep-equal except for the fact that deepEqual(NaN, NaN) === true.

This module is around 5 times faster than wrapping assert.deepEqual() in a try/catch.

browser support

build status

example

var equal = require('deep-is');
console.dir([
    equal(
        { a : [ 2, 3 ], b : [ 4 ] },
        { a : [ 2, 3 ], b : [ 4 ] }
    ),
    equal(
        { x : 5, y : [6] },
        { x : 5, y : 6 }
    )
]);

methods

var deepIs = require('deep-is')

deepIs(a, b)

Compare objects a and b, returning whether they are equal according to a recursive equality algorithm.

install

With npm do:

npm install deep-is

test

With npm do:

npm test

license

Copyright (c) 2012, 2013 Thorsten Lorenz thlorenz@gmx.de Copyright (c) 2012 James Halliday mail@substack.net

Derived largely from node's assert module, which has the copyright statement:

Copyright (c) 2009 Thomas Robinson <280north.com>

Released under the MIT license, see LICENSE for details.

Keywords

FAQs

Last updated on 04 Sep 2021

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc