Comparing version 5.0.0 to 5.0.1
@@ -13,2 +13,3 @@ 'use strict'; | ||
Assert.ifError(result.error); | ||
const rules = new Map(); | ||
@@ -18,3 +19,3 @@ const keys = Object.keys(schema); | ||
const key = keys[i]; | ||
schema[key] = Joi.compile(schema[key]); | ||
rules.set(key, Joi.compile(schema[key])); | ||
} | ||
@@ -24,3 +25,3 @@ | ||
return (req, callback) => { | ||
const spec = schema[source]; | ||
const spec = rules.get(source); | ||
@@ -27,0 +28,0 @@ if (!spec) { |
{ | ||
"name": "celebrate", | ||
"version": "5.0.0", | ||
"version": "5.0.1", | ||
"description": "A joi validation middleware for Express.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -12,4 +12,7 @@ ![Celebrate](https://github.com/continuationlabs/celebrate/raw/master/images/logo.png) | ||
`celebrate` uses ["peerDependencies"](https://docs.npmjs.com/files/package.json#peerdependencies) to manage the required version of `joi` it will use. This means that if you're using npm@3, *you must* install a compatible version of `joi` (currently *10.x.x*) as a top level dependency for `celebrate` to work correctly. `celebrate` does *not* install its own copy of `joi` when using npm@3. This is to maximize compatibility and to keep the number of `joi` version mismatch bugs to a minimum. | ||
`celebrate` lists joi as a formal dependency. This means that celebrate will always use a predictable, known version of joi during the validation and compilation steps. There are two reasons for this: | ||
1. To ensure that `celebrate` can always use the latest version of joi as soon as it's published | ||
2. So that `celebrate` can export the version of joi it uses to the consumer to maximize compatibility | ||
Wondering why *another* joi middleware library for Express? Full blog post [here](https://blog.continuation.io/time-to-celebrate/). | ||
@@ -16,0 +19,0 @@ |
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
113
99
9529