Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
.npmignore build: update .npmignore files (add .meta) Jan 15, 2019 Publish Feb 5, 2019
package.json Publish Feb 5, 2019
tsconfig.json build: prep api, atom, bench, binary, checks, equiv, errors, paths fo… Jan 7, 2019

npm version npm downloads Twitter Follow

This project is part of the monorepo.


Extensible deep equivalence checking for any data types. Supports:

  • JS primitives
  • arrays
  • plain objects
  • ES6 Sets / Maps
  • Date
  • RegExp
  • types with .equiv() implementations (IEquiv interface)

This feature was previously part of the package.


yarn add


Usage examples

import { equiv } from "";

equiv({a: {b: [1, 2]}}, {a: {b: [1, 2]}});
// true

Implement IEquiv interface

This is useful & required for custom types to take part in equiv checks, by default only plain objects & array are traversed deeply.

Furthemore by implementing this interface we can better control which internal values / criteria are required to establish equivalence. In this example we exclude the meta property and only check for same type & children equality.

import { IEquiv } from "";
import { equiv } from "";

class Node implements IEquiv {

    meta: any;
    children: any[];

    constructor(children: any[], meta?) {
        this.children = children;
        this.meta = meta;

    equiv(o: any) {
        return o instanceof Node && equiv(this.children, o.children);

equiv(new Node([1,2,3], "foo"), new Node([1,2,3], "bar"));
// true


  • Karsten Schmidt


© 2018 Karsten Schmidt // Apache Software License 2.0