aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators/search.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/custom-validators/search.ts')
-rw-r--r--server/helpers/custom-validators/search.ts19
1 files changed, 19 insertions, 0 deletions
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 @@
1import * as validator from 'validator'
2import 'express-validator'
3
4import { isArray } from './misc'
5
6function isNumberArray (value: any) {
7 return isArray(value) && value.every(v => validator.isInt('' + v))
8}
9
10function isStringArray (value: any) {
11 return isArray(value) && value.every(v => typeof v === 'string')
12}
13
14// ---------------------------------------------------------------------------
15
16export {
17 isNumberArray,
18 isStringArray
19}