Skip to content

Commit

Permalink
fix type error for nested object
Browse files Browse the repository at this point in the history
  • Loading branch information
lo1tuma committed Mar 16, 2014
1 parent 32665fd commit 9d3420a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/samsam.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@
if (matcher && typeof matcher === "object") {
var prop;
for (prop in matcher) {
if (!match(object[prop], matcher[prop])) {
if (typeof object[prop] === "undefined" || !match(object[prop], matcher[prop])) {
return false;
}
}
Expand Down
1 change: 1 addition & 0 deletions test/samsam-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ if (typeof module === "object" && typeof require === "function") {
fail("mis-ordered array 'subset'", [1, 2, 3], [1, 3]);
pass("empty arrays", [], []);
pass("objects with empty arrays", { xs: [] }, { xs: [] });
fail("nested objects with different depth", { a: 1 }, { b: { c: 2 } });
});

}());

0 comments on commit 9d3420a

Please sign in to comment.