From cda021079ff455cc0fd0eb95a5395fa808ab63d1 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Sat, 30 Jan 2016 17:05:22 +0100 Subject: New directory organization --- helpers/customValidators.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 helpers/customValidators.js (limited to 'helpers/customValidators.js') diff --git a/helpers/customValidators.js b/helpers/customValidators.js new file mode 100644 index 000000000..73c2f8461 --- /dev/null +++ b/helpers/customValidators.js @@ -0,0 +1,29 @@ +;(function () { + 'use strict' + + var validator = require('validator') + + var customValidators = {} + + customValidators.eachIsRemoteVideosAddValid = function (values) { + return values.every(function (val) { + return validator.isLength(val.name, 1, 50) && + validator.isLength(val.description, 1, 50) && + validator.isLength(val.magnetUri, 10) && + validator.isURL(val.podUrl) + }) + } + + customValidators.eachIsRemoteVideosRemoveValid = function (values) { + return values.every(function (val) { + return validator.isLength(val.magnetUri, 10) + }) + } + + customValidators.isArray = function (value) { + return Array.isArray(value) + } + + // ----------- Export ----------- + module.exports = customValidators +})() -- cgit v1.2.3