Comparing version 1.1.1 to 1.1.2
@@ -351,2 +351,10 @@ ((typeof define === "function" && define.amd && function (m) { define("samsam", m); }) || | ||
if (typeof(matcher) === "undefined") { | ||
return typeof(object) === "undefined"; | ||
} | ||
if (matcher === null) { | ||
return object === null; | ||
} | ||
if (getClass(object) === "Array" && getClass(matcher) === "Array") { | ||
@@ -357,2 +365,5 @@ return arrayContains(object, matcher); | ||
if (matcher && typeof matcher === "object") { | ||
if (matcher === object) { | ||
return true; | ||
} | ||
var prop; | ||
@@ -365,3 +376,7 @@ for (prop in matcher) { | ||
} | ||
if (typeof value === "undefined" || !match(value, matcher[prop])) { | ||
if (matcher[prop] === null || typeof matcher[prop] === 'undefined') { | ||
if (value !== matcher[prop]) { | ||
return false; | ||
} | ||
} else if (typeof value === "undefined" || !match(value, matcher[prop])) { | ||
return false; | ||
@@ -368,0 +383,0 @@ } |
{ | ||
"name": "samsam", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Value identification and comparison functions", | ||
@@ -5,0 +5,0 @@ "homepage": "http://busterjs.org/docs/buster-assertions", |
@@ -217,2 +217,7 @@ # samsam | ||
**1.1.2** (11.12.2014) | ||
* Fix for issue [#359 - `assert.match` does not support objects with `null` properties`](https://github.com/busterjs/buster/issues/359) | ||
* Implementation of feature request [#64 - assert.match and parentNode](https://github.com/busterjs/buster/issues/64) | ||
**1.1.1** (26.03.2014) | ||
@@ -222,2 +227,2 @@ | ||
* [Fix type error for nested object in function `match`](https://github.com/busterjs/samsam/commit/9d3420a11e9b3c65559945e60ca56980820db20f) | ||
* Fix for issue [#366, Assertion match fails with data attribute](https://github.com/busterjs/buster/issues/366) | ||
* Fix for issue [#366 - Assertion match fails with data attribute](https://github.com/busterjs/buster/issues/366) |
@@ -360,2 +360,19 @@ if (typeof module === "object" && typeof require === "function") { | ||
}, { "data-path": "foo.bar" }); | ||
pass("equal null properties", { foo: null }, { foo: null }); | ||
fail("unmatched null property", {}, { foo: null }); | ||
fail("matcher with unmatched null property", { foo: 'arbitrary' }, { foo: null }); | ||
pass("equal undefined properties", { foo: undefined }, { foo: undefined }); | ||
fail("matcher with unmatched undefined property", { foo: 'arbitrary' }, { foo: undefined }); | ||
pass('unmatched undefined property', {}, { foo: undefined }); | ||
var obj = { foo: undefined }; | ||
pass("same object matches self", obj, obj); | ||
pass("null matches null", null, null); | ||
fail("null does not match undefined", null, undefined); | ||
pass("undefined matches undefined", undefined, undefined); | ||
fail("undefined does not match null", undefined, null); | ||
}); | ||
@@ -362,0 +379,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
36663
705
227
0
10