Skip to content

Commit

Permalink
added stricter diff check on skippable properties (#15766)
Browse files Browse the repository at this point in the history
fixes #15721
  • Loading branch information
IDCs authored May 29, 2024
1 parent 83bf2da commit 494c79e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/util/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,14 @@ export function truthy(val: any): boolean {
* return the delta between two objects
* @param lhs the left, "before", object
* @param rhs the right, "after", object
* @param skip properties to skip in the diff, string array
*/
export function objDiff(lhs: any, rhs: any, skip?: string[]): any {
const res = {};

if ((typeof(lhs) === 'object') && (typeof(rhs) === 'object')) {
Object.keys(lhs || {}).forEach(key => {
if ((skip !== undefined) && (skip.indexOf(key) !== -1)) {
if ((skip !== undefined) && Array.isArray(skip) && (skip.indexOf(key) !== -1)) {
return;
}
if (!Object.prototype.hasOwnProperty.call(rhs, key)
Expand Down

0 comments on commit 494c79e

Please sign in to comment.