]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/helpers/custom-validators/search.ts
Merge branch 'release/2.1.0' into develop
[github/Chocobozzz/PeerTube.git] / server / helpers / custom-validators / search.ts
1 import validator from 'validator'
2 import { isArray } from './misc'
3
4 function isNumberArray (value: any) {
5 return isArray(value) && value.every(v => validator.isInt('' + v))
6 }
7
8 function isStringArray (value: any) {
9 return isArray(value) && value.every(v => typeof v === 'string')
10 }
11
12 function isNSFWQueryValid (value: any) {
13 return value === 'true' || value === 'false' || value === 'both'
14 }
15
16 // ---------------------------------------------------------------------------
17
18 export {
19 isNumberArray,
20 isStringArray,
21 isNSFWQueryValid
22 }