Comparing version 6.0.0 to 6.0.1
@@ -10,2 +10,4 @@ 'use strict'; | ||
const isCelebrate = Symbol('isCelebrate'); | ||
const Celebrate = (schema, options) => { | ||
@@ -41,2 +43,3 @@ const result = Joi.validate(schema || {}, validations.schema); | ||
if (err) { | ||
err[isCelebrate] = true; | ||
err._meta = { source }; | ||
@@ -73,3 +76,3 @@ return callback(err); | ||
return (err, req, res, next) => { | ||
if (err.isJoi) { | ||
if (err[isCelebrate]) { | ||
const error = { | ||
@@ -87,6 +90,4 @@ statusCode: 400, | ||
for (var i = 0; i < err.details.length; i++) { | ||
// Disabling because the only way to get this is to fake the Joi response which I don't feel like doing | ||
/* $lab:coverage:off$ */ | ||
/* istanbul ignore next */ | ||
const path = Array.isArray(err.details[i].path) ? err.details[i].path.join('.') : err.details[i].path; | ||
/* $lab:coverage:on$ */ | ||
error.validation.keys.push(EscapeHtml(path)); | ||
@@ -93,0 +94,0 @@ } |
{ | ||
"name": "celebrate", | ||
"version": "6.0.0", | ||
"version": "6.0.1", | ||
"description": "A joi validation middleware for Express.", | ||
@@ -8,4 +8,4 @@ "main": "lib/index.js", | ||
"scripts": { | ||
"lint": "belly-button -f", | ||
"test": "npm run lint && lab -v -a code -p -t 100" | ||
"lint": "belly-button -i 'lib/*.js' -f", | ||
"test": "npm run lint && jest --ci" | ||
}, | ||
@@ -36,4 +36,4 @@ "repository": { | ||
"belly-button": "4.x.x", | ||
"code": "4.x.x", | ||
"lab": "14.x.x" | ||
"expect": "21.2.x", | ||
"jest": "21.2.x" | ||
}, | ||
@@ -40,0 +40,0 @@ "engines": { |
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
9687