@sinonjs/samsam
Advanced tools
Comparing version 5.1.0 to 5.2.0
# Changes | ||
## 5.2.0 | ||
- [`f27b87c`](https://github.com/sinonjs/samsam/commit/f27b87cbd493a09e4a3181cf36f503facbbb23fb) | ||
Add match.json (Maximilian Antoni) | ||
_Released by [Maximilian Antoni](https://github.com/mantoni) on 2020-10-06._ | ||
## 5.1.0 | ||
@@ -4,0 +11,0 @@ |
@@ -1032,2 +1032,26 @@ (function (global, factory) { | ||
var jsonParseResultTypes = { | ||
null: true, | ||
boolean: true, | ||
number: true, | ||
string: true, | ||
object: true, | ||
array: true | ||
}; | ||
createMatcher.json = function(value) { | ||
if (!jsonParseResultTypes[typeOf$5(value)]) { | ||
throw new TypeError("Value cannot be the result of JSON.parse"); | ||
} | ||
var message = "json(" + JSON.stringify(value, null, " ") + ")"; | ||
return createMatcher(function(actual) { | ||
var parsed; | ||
try { | ||
parsed = JSON.parse(actual); | ||
} catch (e) { | ||
return false; | ||
} | ||
return deepEqual$1(parsed, value); | ||
}, message); | ||
}; | ||
createMatcher.every = function(predicate) { | ||
@@ -1034,0 +1058,0 @@ assertMatcher_1(predicate); |
@@ -190,2 +190,26 @@ "use strict"; | ||
var jsonParseResultTypes = { | ||
null: true, | ||
boolean: true, | ||
number: true, | ||
string: true, | ||
object: true, | ||
array: true | ||
}; | ||
createMatcher.json = function(value) { | ||
if (!jsonParseResultTypes[typeOf(value)]) { | ||
throw new TypeError("Value cannot be the result of JSON.parse"); | ||
} | ||
var message = "json(" + JSON.stringify(value, null, " ") + ")"; | ||
return createMatcher(function(actual) { | ||
var parsed; | ||
try { | ||
parsed = JSON.parse(actual); | ||
} catch (e) { | ||
return false; | ||
} | ||
return deepEqual(parsed, value); | ||
}, message); | ||
}; | ||
createMatcher.every = function(predicate) { | ||
@@ -192,0 +216,0 @@ assertMatcher(predicate); |
{ | ||
"name": "@sinonjs/samsam", | ||
"version": "5.1.0", | ||
"version": "5.2.0", | ||
"description": "Value identification and comparison functions", | ||
@@ -5,0 +5,0 @@ "homepage": "http://sinonjs.github.io/samsam/", |
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
2577
127943
34