2020-01-07 14:56:07 +01:00
|
|
|
import validator from 'validator'
|
2018-07-20 14:35:18 +02:00
|
|
|
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')
|
|
|
|
}
|
|
|
|
|
2018-07-20 18:31:49 +02:00
|
|
|
function isNSFWQueryValid (value: any) {
|
|
|
|
return value === 'true' || value === 'false' || value === 'both'
|
|
|
|
}
|
|
|
|
|
2018-07-20 14:35:18 +02:00
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
export {
|
|
|
|
isNumberArray,
|
2018-07-20 18:31:49 +02:00
|
|
|
isStringArray,
|
|
|
|
isNSFWQueryValid
|
2018-07-20 14:35:18 +02:00
|
|
|
}
|