data-matching
Advanced tools
Comparing version 1.1.0 to 1.2.0
{ | ||
"name": "data-matching", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Matches a data object against a reference value Edit", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -39,3 +39,3 @@ var _ = require('lodash') | ||
if(full_match) { | ||
if(expected.length != received.length) throw "Array lengths don't match" | ||
if(expected.length != received.length) throw new Error("Array lengths don't match") | ||
} | ||
@@ -59,3 +59,3 @@ for(var i=0 ; i<expected.length ; i++) { | ||
if(keys_r.has(key)) { | ||
throw "Element " + key + " should be absent" | ||
throw new Error("Element " + key + " should be absent") | ||
} else { | ||
@@ -65,4 +65,4 @@ console.log("OK: " + key + ' is absent') | ||
} else { | ||
if(!keys_r.has(key)) throw "Expected element " + key + " not found" | ||
if(!_match(expected[key], received[key], dict, full_match)) throw "No match for element " + key | ||
if(!keys_r.has(key)) throw new Error("Expected element " + key + " not found") | ||
if(!_match(expected[key], received[key], dict, full_match)) throw new Error("No match for element " + key) | ||
} | ||
@@ -74,3 +74,3 @@ | ||
if(full_match) { | ||
if(keys_r.length > 0) throw "Dict full match failed" | ||
if(keys_r.length > 0) throw new Error("Dict full match failed") | ||
} | ||
@@ -95,3 +95,3 @@ return true | ||
} | ||
if(expected != received) throw "Elements expected='" + expected + "' received='" + received + "' don't match" | ||
if(expected != received) throw new Error("Elements expected='" + expected + "' received='" + received + "' don't match") | ||
@@ -121,3 +121,3 @@ return true | ||
} else { | ||
if(dict[var_name] != val) throw "Cannot set " + var_name + " to " + util.inspect(val) + " because it is already set to " + util.inspect(dict[var_name]) | ||
if(dict[var_name] != val) throw new Error("Cannot set " + var_name + " to " + util.inspect(val) + " because it is already set to " + util.inspect(dict[var_name])) | ||
return true | ||
@@ -124,0 +124,0 @@ } |
8849
7