Skip to content

Commit

Permalink
fix: Extension deep compare not quite working for some primitives (#5172
Browse files Browse the repository at this point in the history
)

fix: extension deep compare not quite working for some primitives
  • Loading branch information
valya authored Jan 16, 2023
1 parent 582865c commit 98017dc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/workflow/src/Extensions/ArrayExtensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ function deepCompare(left: unknown, right: unknown): boolean {
return true;
}

// Explicitly return false if certain primitives don't equal each other
if (['number', 'string', 'bigint', 'boolean', 'symbol'].includes(typeof left) && left !== right) {
return false;
}

// Quickly check how many properties each has to avoid checking obviously mismatching
// objects
if (Object.keys(left as object).length !== Object.keys(right as object).length) {
Expand Down

0 comments on commit 98017dc

Please sign in to comment.