Comparing version 7.0.1 to 7.0.2
import { ErrorRequestHandler, RequestHandler } from 'express'; | ||
import { Root as joi } from 'joi'; | ||
@@ -6,5 +7,6 @@ declare namespace Celebrate { | ||
* Creates a Celebrate middleware function. | ||
* @param {object} schema object where each key is one of ["params", "headers", "query", "body"] and the value is | ||
* @param {Object} schema - object where each key is one of ["params", "headers", "query", "body"] and the value is | ||
* a Joi schema. | ||
* @param {object} config optional configuration options that will be passed directly into Joi. | ||
* @param {Object} [config] - optional configuration options that will be passed directly into Joi. | ||
* @returns {Function} an express middleware function | ||
*/ | ||
@@ -19,2 +21,3 @@ function celebrate(schema: { | ||
* Creates a Celebrate error handler middleware function. | ||
* @returns {Function} an express error handler function | ||
*/ | ||
@@ -25,5 +28,12 @@ function errors(): ErrorRequestHandler; | ||
*/ | ||
export const Joi: object; | ||
export const Joi: joi | ||
/** | ||
* Examines an error object to determine if it originated from the celebrate middleware. | ||
* @param {Object} err - error object to check | ||
* @returns {boolean} | ||
*/ | ||
function isCelebrate(err:object): boolean; | ||
} | ||
export = Celebrate; |
@@ -62,3 +62,3 @@ 'use strict'; | ||
const rules = new Map(); | ||
options = Object.assign({}, DEFAULTS, options); | ||
const joiOpts = Object.assign({}, DEFAULTS, options); | ||
@@ -84,3 +84,3 @@ const keys = Object.keys(schema); | ||
req, | ||
options, | ||
options: joiOpts, | ||
rules | ||
@@ -87,0 +87,0 @@ }, next); |
{ | ||
"name": "celebrate", | ||
"version": "7.0.1", | ||
"version": "7.0.2", | ||
"description": "A joi validation middleware for Express.", | ||
@@ -34,2 +34,3 @@ "main": "lib/index.js", | ||
"@types/express": "4.x.x", | ||
"@types/joi": "13.0.0", | ||
"artificial": "0.1.x", | ||
@@ -36,0 +37,0 @@ "belly-button": "4.x.x", |
11300
153
8