1.5.1 • Published 5 years ago

@trinitymirrordigital/deep_equals v1.5.1

Weekly downloads
-
License
ISC
Repository
bitbucket
Last release
5 years ago

@trinitymirrordigital/deep_equals

Function to deep compare two objects or arrays for changes

Usage

import deepEquals from '@trinitymirrordigital/deep_equals';

const obj1 = {
  test: 'foo',
  test2: [1, 2, 3]
}

const obj2 = {
  test: 'foo',
  test2: [1, 2, 3]
}

const obj3 = {
  test: 'foo',
  test2: [1, 2, 2]
}

obj1 === obj2 // returns false
deepEquals(obj1, obj2); // return true

obj1 === obj3 // returns false
deepEquals(obj1, obj3); // return false

const array1 = [{
  test: 'foo',
  test2: [1, 2, 3]
}]

const array2 = [{
  test: 'foo',
  test2: [1, 2, 3]
}]

const array3 = [{
  test: 'foo',
  test2: [1, 2, 2]
}]

array1 === array2 // returns false
deepEquals(array1, array2); // return true

array1 === array3 // returns false
deepEquals(array1, array3); // return false