From 9f10b2928df655c3672d9607e864e667d4bc903a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Sun, 7 Feb 2016 11:23:23 +0100 Subject: Remove useless anonymous functions of files --- middlewares/reqValidators/pods.js | 80 +++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 41 deletions(-) (limited to 'middlewares/reqValidators/pods.js') diff --git a/middlewares/reqValidators/pods.js b/middlewares/reqValidators/pods.js index 4d649b486..7d1612dde 100644 --- a/middlewares/reqValidators/pods.js +++ b/middlewares/reqValidators/pods.js @@ -1,41 +1,39 @@ -;(function () { - 'use strict' - - var checkErrors = require('./utils').checkErrors - var friends = require('../../lib/friends') - var logger = require('../../helpers/logger') - - var reqValidatorsPod = { - makeFriends: makeFriends, - podsAdd: podsAdd - } - - function makeFriends (req, res, next) { - friends.hasFriends(function (err, has_friends) { - if (err) { - logger.error('Cannot know if we have friends.', { error: err }) - res.sendStatus(500) - } - - if (has_friends === true) { - // We need to quit our friends before make new ones - res.sendStatus(409) - } else { - next() - } - }) - } - - function podsAdd (req, res, next) { - req.checkBody('data.url', 'Should have an url').notEmpty().isURL({ require_protocol: true }) - req.checkBody('data.publicKey', 'Should have a public key').notEmpty() - - logger.debug('Checking podsAdd parameters', { parameters: req.body }) - - checkErrors(req, res, next) - } - - // --------------------------------------------------------------------------- - - module.exports = reqValidatorsPod -})() +'use strict' + +var checkErrors = require('./utils').checkErrors +var friends = require('../../lib/friends') +var logger = require('../../helpers/logger') + +var reqValidatorsPod = { + makeFriends: makeFriends, + podsAdd: podsAdd +} + +function makeFriends (req, res, next) { + friends.hasFriends(function (err, has_friends) { + if (err) { + logger.error('Cannot know if we have friends.', { error: err }) + res.sendStatus(500) + } + + if (has_friends === true) { + // We need to quit our friends before make new ones + res.sendStatus(409) + } else { + next() + } + }) +} + +function podsAdd (req, res, next) { + req.checkBody('data.url', 'Should have an url').notEmpty().isURL({ require_protocol: true }) + req.checkBody('data.publicKey', 'Should have a public key').notEmpty() + + logger.debug('Checking podsAdd parameters', { parameters: req.body }) + + checkErrors(req, res, next) +} + +// --------------------------------------------------------------------------- + +module.exports = reqValidatorsPod -- cgit v1.2.3