forked from DevExpress/testcafe
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
report only modified options in reportActionDone(closes DevExpress#4926)
- Loading branch information
1 parent
34bce8d
commit f30b52e
Showing
2 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { Dictionary } from '../configuration/interfaces'; | ||
|
||
function diff (object1: Dictionary<any>, object2: Dictionary<any>, result: Dictionary<any> = {}): Dictionary<any> { | ||
for (const prop in object1) { | ||
const value1 = object1[prop]; | ||
const value2 = object2[prop]; | ||
|
||
if (value1 !== value2) { | ||
if (typeof value1 === 'object' && typeof value2 === 'object') { | ||
result[prop] = {}; | ||
|
||
diff(value1 as Dictionary<object>, value2 as Dictionary<object>, result[prop]); | ||
} | ||
else | ||
result[prop] = value2; | ||
} | ||
} | ||
|
||
return result; | ||
} | ||
|
||
export default (object1: Dictionary<any>, object2: Dictionary<any>) => { | ||
const result = {}; | ||
|
||
diff(object1, object2, result); | ||
|
||
return result; | ||
}; |