From 825cba21a4a4b784d2059719d7ef6f86b87eecc3 Mon Sep 17 00:00:00 2001 From: Olivier Dalang Date: Mon, 8 Nov 2021 16:04:42 +0100 Subject: [PATCH] Fix comparison bug in case of NULL values See https://github.com/michaelsogos/pg-diff/issues/45 --- src/api/CompareApi.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/CompareApi.js b/src/api/CompareApi.js index fddf289..262011a 100644 --- a/src/api/CompareApi.js +++ b/src/api/CompareApi.js @@ -1458,7 +1458,7 @@ class CompareApi { } /** - * + * Returns true if there is a difference between source and target vlue * @param {Object} sourceValue * @param {Object} targetValue */ @@ -1466,7 +1466,7 @@ class CompareApi { var sourceValueType = typeof sourceValue; var targetValueType = typeof targetValue; - if (sourceValueType != targetValueType) return false; + if (sourceValueType != targetValueType) return true; else if (sourceValue instanceof Date) return sourceValue.getTime() !== targetValue.getTime(); else if (sourceValue instanceof Object) return !deepEqual(sourceValue, targetValue); else return sourceValue !== targetValue;