lite-deep-equal

1.0.6 • Public • Published

lite-deep-equal

Build Status

A simple lightweight alternative for deep-equal

This package is based on https://stackoverflow.com/a/32922084/1866804

Compatible with Node and Browser

This package support all basic types in Javascript: Object, Array, Number, String, null & undefined

Install

npm install lite-deep-equal

Usage

const deepEqual = require('lite-deep-equal');

console.dir(
  deepEqual(
    { a: [2, 3], b: [4] },
    { a: [2, 3], b: [4] },
  ),
);


// => true

console.dir(
  deepEqual(
    { x: 5, y: [6] },
    { x: 5, y: 6 },
  ),
);


// => false

console.dir(
  deepEqual(
    {
      a: [2, 3],
      c: {
        e: ['hello', 2],
      },
      b: [4],
      d: null,
    },
    {
      a: [2, 3],
      b: [4],
      c: {
        e: ['hello', 2],
      },
      d: null,
    },
  ),
);

// => true

Methods

deepEqual(a, b, opts)

const deepEqual = require('lite-deep-equal');

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

Contributing

PR's are welcome!

Thanks to all the contributors!

Package Sidebar

Install

npm i lite-deep-equal

Weekly Downloads

1

Version

1.0.6

License

GPL-3.0-or-later

Unpacked Size

38.8 kB

Total Files

5

Last publish

Collaborators

  • vishalvijay