2020-02-14 16:14:45 +01:00
|
|
|
import { isArray } from './misc'
|
2020-05-28 11:37:47 +02:00
|
|
|
import validator from 'validator'
|
2020-02-14 16:14:45 +01:00
|
|
|
|
|
|
|
function isNumberArray (value: any) {
|
2020-05-28 11:37:47 +02:00
|
|
|
return isArray(value) && value.every(v => validator.isInt('' + v))
|
2020-02-14 16:14:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function isStringArray (value: any) {
|
|
|
|
return isArray(value) && value.every(v => typeof v === 'string')
|
|
|
|
}
|
|
|
|
|
|
|
|
function isNSFWQueryValid (value: any) {
|
|
|
|
return value === 'true' || value === 'false' || value === 'both'
|
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
export {
|
|
|
|
isNumberArray,
|
|
|
|
isStringArray,
|
|
|
|
isNSFWQueryValid
|
|
|
|
}
|