npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@orin00/deep-equal-util

v1.0.0

Published

A recursive deep equality comparison utility for Node.js and Browser environments.

Downloads

8

Readme

deep-equal-strict

A strict deep equality comparison utility for JavaScript.
Designed for correctness over performance, with explicit handling of edge cases such as NaN, -0, circular references, Map, Set, Symbol, and prototype checks.

This library intentionally avoids heuristic shortcuts and follows a well-defined comparison policy.


Features

  • Strict numeric comparison
    • Uses Object.is only
    • NaN equals NaN
    • 0 and -0 are treated as different
  • 🔁 Circular reference safe
    • Uses symmetric pair caching with nested WeakMap
  • 🧠 Deep comparison
    • Recursively compares:
      • Objects
      • Arrays
      • Map (including deep comparison of keys)
      • Set (order-independent, 1:1 matching)
  • 🧬 Prototype-aware
    • Objects with different prototypes are not equal
  • 🧿 Symbol & non-enumerable properties
    • Compared via Reflect.ownKeys
  • 🌐 UMD compatible
    • Works in Node.js and browsers

Installation

npm

npm install deep-equal-strict

yarn

yarn add deep-equal-strict


Usage

CommonJS (Node.js)

""" const deepEqual = require('deep-equal-strict');

deepEqual({ a: 1 }, { a: 1 }); // true """

Browser (Global)

"""

"""


Examples

Basic Objects

""" deepEqual( { a: 1, b: { c: 2 } }, { a: 1, b: { c: 2 } } ); // true """

Strict Numeric Comparison

""" deepEqual(NaN, NaN); // true deepEqual(0, -0); // false """

Circular References

""" const a = {}; a.self = a;

const b = {}; b.self = b;

deepEqual(a, b); // true """

Map (Deep Key Comparison)

""" const mapA = new Map([[{ id: 1 }, 'value']]); const mapB = new Map([[{ id: 1 }, 'value']]);

deepEqual(mapA, mapB); // true """

Set (Order Independent)

""" const setA = new Set([{ x: 1 }, { y: 2 }]); const setB = new Set([{ y: 2 }, { x: 1 }]);

deepEqual(setA, setB); // true """

Symbols & Non-enumerable Properties

""" const sym = Symbol('key');

const a = {}; Object.defineProperty(a, sym, { value: 42 });

const b = {}; Object.defineProperty(b, sym, { value: 42 });

deepEqual(a, b); // true """

Prototype Mismatch

""" const a = { x: 1 }; const b = Object.create(null); b.x = 1;

deepEqual(a, b); // false """

Functions

""" const fn = () => 1;

deepEqual(fn, fn); // true deepEqual(() => 1, () => 1); // false """

Error Objects

""" deepEqual( new Error('fail'), new Error('fail') ); // usually false (stack differs) """


Design Notes (Strict Mode)

Correctness first, performance second

Map and Set comparisons are O(n²) by design

Functions are compared by reference only

Error objects are compared structurally and may differ by environment

Property descriptors (writable, getter, etc.) are not compared

This library is not intended to be a drop-in replacement for lodash.isEqual. It is designed for users who want predictable and explicit equality semantics.

When to Use

You need deterministic deep equality

You care about NaN, -0, and prototype correctness

You work with complex structures (Map, Set, circular graphs)

When NOT to Use

Performance-critical hot paths

JSON-only shallow comparisons

Heuristic or fuzzy equality needs

License : MIT