From d525fc399a14a8b16eaad6d4c0bc0a9c4093c3c9 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 20 Jul 2018 14:35:18 +0200 Subject: Add videos list filters --- server/helpers/custom-validators/search.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 server/helpers/custom-validators/search.ts (limited to 'server/helpers/custom-validators/search.ts') diff --git a/server/helpers/custom-validators/search.ts b/server/helpers/custom-validators/search.ts new file mode 100644 index 000000000..2fde39160 --- /dev/null +++ b/server/helpers/custom-validators/search.ts @@ -0,0 +1,19 @@ +import * as validator from 'validator' +import 'express-validator' + +import { isArray } from './misc' + +function isNumberArray (value: any) { + return isArray(value) && value.every(v => validator.isInt('' + v)) +} + +function isStringArray (value: any) { + return isArray(value) && value.every(v => typeof v === 'string') +} + +// --------------------------------------------------------------------------- + +export { + isNumberArray, + isStringArray +} -- cgit v1.2.3