How to get shallowCompareObjects

import { shallowCompareObjects } from 'fds/system';

Type: Function

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.


# Name Type Description
1. object1 Object

Object to compare to "object2".

2. object2 Object

Object to compare to "object1".


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.

Was this page helpful?