Skip to content

Commit

Permalink
Removed pointless micro-opt
Browse files Browse the repository at this point in the history
  • Loading branch information
arb committed Sep 17, 2020
1 parent 36a3e47 commit 9bf1b10
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/celebrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,9 @@ exports.celebrate = (_requestRules, joiOpts = {}, opts = {}) => {

// Compile all schemas in advance and only do it once
const requestRules = new Map();
// eslint-disable-next-line no-restricted-syntax
for (const key in _requestRules) {
if ({}.hasOwnProperty.call(_requestRules, key)) {
requestRules.set(key, Joi.compile(_requestRules[key]));
}
}
Object.entries(_requestRules).reduce(
(memo, [key, value]) => memo.set(key, Joi.compile(value)), requestRules,
);

const middleware = (req, res, next) => {
const joiConfig = finalOpts.reqContext ? {
Expand Down

0 comments on commit 9bf1b10

Please sign in to comment.