( obj1: NestedObjectMap<K, T>, obj2: NestedObjectMap<K, T>, )
| 76 | |
| 77 | // returns an object with properties from obj1 not included in obj2 |
| 78 | function deepDiff<K, T>( |
| 79 | obj1: NestedObjectMap<K, T>, |
| 80 | obj2: NestedObjectMap<K, T>, |
| 81 | ): NestedObjectMap<K, T> { |
| 82 | let diff: NestedObjectMap<K, T> = {}; |
| 83 | Object.keys(obj1).forEach((key: K) => { |
| 84 | if (_isEqual(obj1[key], obj2[key])) { |
| 85 | return; |
| 86 | } |
| 87 | |
| 88 | if (!_isPlainObject(obj1[key]) || !_isPlainObject(obj2[key])) { |
| 89 | diff = assignValueWithKey(diff, key, obj1[key]); |
| 90 | return; |
| 91 | } |
| 92 | |
| 93 | const nestedObj1: ObjectMap<K, T> = (obj1[key]: any); |
| 94 | const nestedObj2: ObjectMap<K, T> = (obj2[key]: any); |
| 95 | |
| 96 | const nestedDiff = deepDiff(nestedObj1, nestedObj2); |
| 97 | if (Object.keys(nestedDiff).length > 0) { |
| 98 | diff = assignValueWithKey(diff, key, nestedDiff); |
| 99 | } |
| 100 | }); |
| 101 | return diff; |
| 102 | } |
| 103 | |
| 104 | function assertObjectsAreEqual<K, T>( |
| 105 | processedObject: ObjectMap<K, T>, |
no test coverage detected