goodeggs-json-schema-validator
Advanced tools
Comparing version 4.0.0 to 4.1.0
12
index.js
'use strict'; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
var _tv = require('tv4'); | ||
@@ -7,2 +9,6 @@ | ||
var _assert = require('assert'); | ||
var _assert2 = _interopRequireDefault(_assert); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -56,2 +62,4 @@ | ||
module.exports.assertValid = function (data, schema) { | ||
(0, _assert2.default)(data !== undefined, 'data must be defined'); | ||
(0, _assert2.default)((typeof schema === 'undefined' ? 'undefined' : _typeof(schema)) === 'object', 'schema must be an object'); | ||
var cleanedData = JSON.parse(JSON.stringify(data)); // remove undefined, convert dates to ISO strings, etc | ||
@@ -65,3 +73,5 @@ | ||
var message = function () { | ||
var result = 'failed schema validation'; | ||
var result = 'failed'; | ||
if (schema.title) result += ' "' + schema.title + '"'; | ||
result += ' schema validation'; | ||
if (error.schemaPath.length) result += ' at ' + error.schemaPath; | ||
@@ -68,0 +78,0 @@ result += '; ' + error.message.toLowerCase(); |
{ | ||
"name": "goodeggs-json-schema-validator", | ||
"version": "4.0.0", | ||
"version": "4.1.0", | ||
"description": "Good Eggs JSON Schema Validator", | ||
@@ -61,3 +61,4 @@ "author": "Good Eggs <open-source@goodeggs.com>", | ||
"rules": { | ||
"lodash/prefer-lodash-typecheck": "off" | ||
"lodash/prefer-lodash-typecheck": "off", | ||
"no-eq-null": "off" | ||
}, | ||
@@ -64,0 +65,0 @@ "env": { |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
5998
67
0