Comparing version 4.1.6 to 4.2.0
4.2.0 / 2018-01-21 | ||
================== | ||
* Add match.every and match.some (#1624) (#1661) | ||
4.1.6 / 2018-01-16 | ||
@@ -3,0 +8,0 @@ ================== |
@@ -246,2 +246,38 @@ "use strict"; | ||
match.every = function (predicate) { | ||
if (!isMatcher(predicate)) { | ||
throw new TypeError("Matcher expected"); | ||
} | ||
return match(function (actual) { | ||
if (typeOf(actual) === "object") { | ||
return every(Object.keys(actual), function (key) { | ||
return predicate.test(actual[key]); | ||
}); | ||
} | ||
return !!actual && typeOf(actual.forEach) === "function" && every(actual, function (element) { | ||
return predicate.test(element); | ||
}); | ||
}, "every(" + predicate.message + ")"); | ||
}; | ||
match.some = function (predicate) { | ||
if (!isMatcher(predicate)) { | ||
throw new TypeError("Matcher expected"); | ||
} | ||
return match(function (actual) { | ||
if (typeOf(actual) === "object") { | ||
return !every(Object.keys(actual), function (key) { | ||
return !predicate.test(actual[key]); | ||
}); | ||
} | ||
return !!actual && typeOf(actual.forEach) === "function" && !every(actual, function (element) { | ||
return !predicate.test(element); | ||
}); | ||
}, "some(" + predicate.message + ")"); | ||
}; | ||
match.array = match.typeOf("array"); | ||
@@ -248,0 +284,0 @@ |
{ | ||
"name": "sinon", | ||
"description": "JavaScript test spies, stubs and mocks.", | ||
"version": "4.1.6", | ||
"version": "4.2.0", | ||
"homepage": "http://sinonjs.org/", | ||
@@ -6,0 +6,0 @@ "author": "Christian Johansen", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
3442112
50
36049