]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - middlewares/reqValidators/utils.js
Remove useless anonymous functions of files
[github/Chocobozzz/PeerTube.git] / middlewares / reqValidators / utils.js
index c88f6df2e85125906b046ab01ec5e48edb9b7ac8..46c9825714f6c1b8ee9da101d7d1d1a388ab033e 100644 (file)
@@ -1,27 +1,25 @@
-;(function () {
-  'use strict'
+'use strict'
 
-  var util = require('util')
+var util = require('util')
 
-  var logger = require('../../helpers/logger')
+var logger = require('../../helpers/logger')
 
-  var reqValidatorsUtils = {
-    checkErrors: checkErrors
-  }
-
-  function checkErrors (req, res, next, status_code) {
-    if (status_code === undefined) status_code = 400
-    var errors = req.validationErrors()
+var reqValidatorsUtils = {
+  checkErrors: checkErrors
+}
 
-    if (errors) {
-      logger.warn('Incorrect request parameters', { path: req.originalUrl, err: errors })
-      return res.status(status_code).send('There have been validation errors: ' + util.inspect(errors))
-    }
+function checkErrors (req, res, next, status_code) {
+  if (status_code === undefined) status_code = 400
+  var errors = req.validationErrors()
 
-    return next()
+  if (errors) {
+    logger.warn('Incorrect request parameters', { path: req.originalUrl, err: errors })
+    return res.status(status_code).send('There have been validation errors: ' + util.inspect(errors))
   }
 
-  // ---------------------------------------------------------------------------
+  return next()
+}
+
+// ---------------------------------------------------------------------------
 
-  module.exports = reqValidatorsUtils
-})()
+module.exports = reqValidatorsUtils