shallowCompareObjects

Type: Function

How to get shallowCompareObjects?

JavaScript

import { shallowCompareObjects } from 'fds/system';

Shallowly compares the keys and values of two objects with each other.

Note that this utility should only be used for simple comparison usages. When comparing prototypes like dates, arrays or nested objects, it's important to know that JavaScript compares these by reference. Even though two objects have the exact same properties and values, if they're both created at a different point in the code they won't point to the same location in memory. In these cases you might need to do a manual deep comparison.

Arguments

  1. object1

    (Required)

    Type: Object

    Object to compare to "object2".

  2. object2

    (Required)

    Type: Object

    Object to compare to "object1".

Returns

Type: Boolean

Whether or not the objects shallowly differ from each other. Returns true if the objects are different, returns false if they're the same.