aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators/search.ts
blob: 2fde391602014aa33ee46726e7dddfa7c7c041fc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
}