Socket
Socket
Sign inDemoInstall

samsam

Package Overview
Dependencies
Maintainers
3
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

samsam - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

17

lib/samsam.js

@@ -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 @@ }

2

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc