Comparing version 1.1.0 to 1.1.1
@@ -32,2 +32,3 @@ ((typeof define === "function" && define.amd && function (m) { define("samsam", m); }) || | ||
function isArguments(object) { | ||
if (getClass(object) === 'Arguments') { return true; } | ||
if (typeof object !== "object" || typeof object.length !== "number" || | ||
@@ -358,3 +359,8 @@ getClass(object) === "Array") { | ||
for (prop in matcher) { | ||
if (!match(object[prop], matcher[prop])) { | ||
var value = object[prop]; | ||
if (typeof value === "undefined" && | ||
typeof object.getAttribute === "function") { | ||
value = object.getAttribute(prop); | ||
} | ||
if (typeof value === "undefined" || !match(value, matcher[prop])) { | ||
return false; | ||
@@ -361,0 +367,0 @@ } |
{ | ||
"name": "samsam", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Value identification and comparison functions", | ||
@@ -26,3 +26,4 @@ "homepage": "http://busterjs.org/docs/buster-assertions", | ||
"scripts": { | ||
"test": "node test/samsam-test.js" | ||
"test": "node test/samsam-test.js", | ||
"test-debug": "node --debug-brk test/samsam-test.js" | ||
}, | ||
@@ -29,0 +30,0 @@ "devDependencies": { |
@@ -7,2 +7,5 @@ if (typeof module === "object" && typeof require === "function") { | ||
(function () { | ||
var assert = buster.assert; | ||
function tests(method, body) { | ||
@@ -343,4 +346,26 @@ var tc = {}; | ||
pass("objects with empty arrays", { xs: [] }, { xs: [] }); | ||
fail("nested objects with different depth", { a: 1 }, { b: { c: 2 } }); | ||
pass("dom elements with matching data attributes", { | ||
getAttribute: function (name) { | ||
if (name === "data-path") { | ||
return "foo.bar"; | ||
} | ||
} | ||
}, { "data-path": "foo.bar" }); | ||
fail("dom elements with not matching data attributes", { | ||
getAttribute: function (name) { | ||
if (name === "data-path") { | ||
return "foo.foo"; | ||
} | ||
} | ||
}, { "data-path": "foo.bar" }); | ||
}); | ||
tests("isArguments", function (pass, fail) { | ||
pass("arguments object", arguments); | ||
fail("primitive", 42); | ||
fail("object", {}); | ||
pass("arguments object from strict-mode function", | ||
(function () { "use strict"; return arguments; }())); | ||
}); | ||
}()); |
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
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
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
35313
11
680
222
0
1