diff --git a/lib/scoreProperties.js b/lib/scoreProperties.js index 3d13b77..c73f665 100644 --- a/lib/scoreProperties.js +++ b/lib/scoreProperties.js @@ -20,7 +20,7 @@ function scorePrimitiveProperty(expectation, result, weight) { * through all the keys, calculating the subscores, and aggregating them */ function scoreProperties(expectation, result, weight) { - if (isObject(expectation)) { + if (isObject(expectation) && isObject(result)) { weight = weight || {}; var subscores = Object.keys(expectation).map(function(property){ return scoreProperties(expectation[property], result[property], weight[property]);