goodeggs-json-schema-validator
Advanced tools
Comparing version 4.1.0 to 4.2.0
@@ -60,5 +60,6 @@ 'use strict'; | ||
module.exports = _tv2.default; | ||
module.exports.assertValid = function (data, schema) { | ||
module.exports.assertValid = function (data, schema, errorMessage) { | ||
(0, _assert2.default)(data !== undefined, 'data must be defined'); | ||
(0, _assert2.default)((typeof schema === 'undefined' ? 'undefined' : _typeof(schema)) === 'object', 'schema must be an object'); | ||
if (errorMessage != null) (0, _assert2.default)(typeof errorMessage === 'string', 'errorMessage must be a string'); | ||
var cleanedData = JSON.parse(JSON.stringify(data)); // remove undefined, convert dates to ISO strings, etc | ||
@@ -72,3 +73,5 @@ | ||
var message = function () { | ||
var result = 'failed'; | ||
var result = ''; | ||
if (errorMessage) result += errorMessage + '; '; | ||
result += 'failed'; | ||
if (schema.title) result += ' "' + schema.title + '"'; | ||
@@ -75,0 +78,0 @@ result += ' schema validation'; |
{ | ||
"name": "goodeggs-json-schema-validator", | ||
"version": "4.1.0", | ||
"version": "4.2.0", | ||
"description": "Good Eggs JSON Schema Validator", | ||
@@ -5,0 +5,0 @@ "author": "Good Eggs <open-source@goodeggs.com>", |
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
6205
70