2018-07-20 08:35:18 -04:00
|
|
|
import * as validator from 'validator'
|
|
|
|
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 12:31:49 -04:00
|
|
|
function isNSFWQueryValid (value: any) {
|
|
|
|
return value === 'true' || value === 'false' || value === 'both'
|
|
|
|
}
|
|
|
|
|
2018-07-20 08:35:18 -04:00
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
export {
|
|
|
|
isNumberArray,
|
2018-07-20 12:31:49 -04:00
|
|
|
isStringArray,
|
|
|
|
isNSFWQueryValid
|
2018-07-20 08:35:18 -04:00
|
|
|
}
|