Comparing version 2.0.0 to 2.1.0
@@ -9,3 +9,3 @@ 'use strict'; | ||
module.exports = (schema) => { | ||
module.exports = (schema, options) => { | ||
const result = Joi.validate(schema || {}, validations.schema); | ||
@@ -28,3 +28,3 @@ Assert.ifError(result.error); | ||
Joi.validate(req[source], spec, (err, value) => { | ||
Joi.validate(req[source], spec, options, (err, value) => { | ||
if (value !== undefined) { | ||
@@ -31,0 +31,0 @@ // Apply any Joi transforms back to the request |
{ | ||
"name": "celebrate", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "A joi validation middleware for Express.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -75,3 +75,3 @@ ![Celebrate](https://github.com/continuationlabs/celebrate/raw/master/images/logo.png) | ||
### `celebrate(schema)` | ||
### `celebrate(schema, [options])` | ||
@@ -81,2 +81,3 @@ Returns a `function` with the middleware signature (`(req, res, next)`). | ||
- `schema` - a object where `key` can be one of `'params', 'headers', 'query', and 'body'` and the `value` is a [joi](https://github.com/hapijs/joi/blob/master/API.md) validation schema. Only the `key`s specified will be validated against the incomming `req` object. If you omit a key, that part of the `req` object will not be validated. A schema must contain at least one of the valid keys. | ||
- `[options]` - `joi` [options](https://github.com/hapijs/joi/blob/master/API.md#validatevalue-schema-options-callback) that are passed directly into the `validate` function. | ||
@@ -83,0 +84,0 @@ ## Order |
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
6795
95