smart-eql

Smart deep equality testing for Node.js. This was forked from deep-eql, with the addition of regex and function testing.

Usage no npm install needed!

<script type="module">
  import smartEql from 'https://cdn.skypack.dev/smart-eql';
</script>

README

smart-eql Build Status

Smart deep equality testing for Node.js. This was forked from deep-eql, with the addition of regex and function testing.

Installation

smart-eql is available on npm.

$ npm install --save smart-eql

Usage

Rules

  • Strict equality for non-traversable nodes according to egal.
    • eql(NaN, NaN).should.be.true;
    • eql(-0, +0).should.be.false;
  • Arguments are not Arrays:
    • eql([], arguments).should.be.false;
    • eql([], Array.prototype.slice.call(arguments)).should.be.true;
  • Use regex to test values:
    • eql({a: /he.+world/}, {a: 'hello world'}).should.be.true;
    • eql('hxllo world', /he.+world/).should.be.false;