1 import validator from 'validator'
2 import { CONSTRAINTS_FIELDS } from '../../initializers/constants'
3 import { exists } from './misc'
5 const VIDEO_CHANNELS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_CHANNELS
7 function isVideoChannelDescriptionValid (value: string) {
8 return value === null || validator.isLength(value, VIDEO_CHANNELS_CONSTRAINTS_FIELDS.DESCRIPTION)
11 function isVideoChannelNameValid (value: string) {
12 return exists(value) && validator.isLength(value, VIDEO_CHANNELS_CONSTRAINTS_FIELDS.NAME)
15 function isVideoChannelSupportValid (value: string) {
16 return value === null || (exists(value) && validator.isLength(value, VIDEO_CHANNELS_CONSTRAINTS_FIELDS.SUPPORT))
19 // ---------------------------------------------------------------------------
22 isVideoChannelDescriptionValid,
23 isVideoChannelNameValid,
24 isVideoChannelSupportValid