]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/helpers/custom-validators/search.ts
Fix search query when updating from typeahead
[github/Chocobozzz/PeerTube.git] / server / helpers / custom-validators / search.ts
CommitLineData
7cde3b9c 1import validator from 'validator'
d525fc39
C
2import { isArray } from './misc'
3
4function isNumberArray (value: any) {
5 return isArray(value) && value.every(v => validator.isInt('' + v))
6}
7
8function isStringArray (value: any) {
9 return isArray(value) && value.every(v => typeof v === 'string')
10}
11
0b18f4aa
C
12function isNSFWQueryValid (value: any) {
13 return value === 'true' || value === 'false' || value === 'both'
14}
15
d525fc39
C
16// ---------------------------------------------------------------------------
17
18export {
19 isNumberArray,
0b18f4aa
C
20 isStringArray,
21 isNSFWQueryValid
d525fc39 22}