Today, I encountered a bug while comparing two objects using getObjectDiff. In the prevData object, a property had an array value, while in the nextData object, the same property had a non-array value. The isEqual function failed because it only checks if value a is an array. If a is an array, it attempts to get the length of value b, which causes an error when b is not an array.
This fix ensures that the comparison logic correctly handles cases where an array is compared to a non-array value, preventing such errors.
Today, I encountered a bug while comparing two objects using
getObjectDiff
. In theprevData
object, a property had an array value, while in thenextData
object, the same property had a non-array value. TheisEqual
function failed because it only checks if valuea
is an array. Ifa
is an array, it attempts to get the length of valueb
, which causes an error whenb
is not an array.This fix ensures that the comparison logic correctly handles cases where an array is compared to a non-array value, preventing such errors.