]>
Commit | Line | Data |
---|---|---|
d525fc39 C |
1 | import * as validator from 'validator' |
2 | import 'express-validator' | |
3 | ||
4 | import { isArray } from './misc' | |
5 | ||
6 | function isNumberArray (value: any) { | |
7 | return isArray(value) && value.every(v => validator.isInt('' + v)) | |
8 | } | |
9 | ||
10 | function isStringArray (value: any) { | |
11 | return isArray(value) && value.every(v => typeof v === 'string') | |
12 | } | |
13 | ||
0b18f4aa C |
14 | function isNSFWQueryValid (value: any) { |
15 | return value === 'true' || value === 'false' || value === 'both' | |
16 | } | |
17 | ||
d525fc39 C |
18 | // --------------------------------------------------------------------------- |
19 | ||
20 | export { | |
21 | isNumberArray, | |
0b18f4aa C |
22 | isStringArray, |
23 | isNSFWQueryValid | |
d525fc39 | 24 | } |