]>
Commit | Line | Data |
---|---|---|
7cde3b9c | 1 | import validator from 'validator' |
74dc3bca | 2 | import { CONSTRAINTS_FIELDS } from '../../initializers/constants' |
4e50b6a1 | 3 | import { exists } from './misc' |
72c7248b C |
4 | |
5 | const VIDEO_CHANNELS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_CHANNELS | |
6 | ||
7 | function isVideoChannelDescriptionValid (value: string) { | |
8 | return value === null || validator.isLength(value, VIDEO_CHANNELS_CONSTRAINTS_FIELDS.DESCRIPTION) | |
9 | } | |
10 | ||
11 | function isVideoChannelNameValid (value: string) { | |
12 | return exists(value) && validator.isLength(value, VIDEO_CHANNELS_CONSTRAINTS_FIELDS.NAME) | |
13 | } | |
14 | ||
2422c46b C |
15 | function isVideoChannelSupportValid (value: string) { |
16 | return value === null || (exists(value) && validator.isLength(value, VIDEO_CHANNELS_CONSTRAINTS_FIELDS.SUPPORT)) | |
17 | } | |
18 | ||
72c7248b C |
19 | // --------------------------------------------------------------------------- |
20 | ||
21 | export { | |
22 | isVideoChannelDescriptionValid, | |
4e50b6a1 | 23 | isVideoChannelNameValid, |
5b77537c | 24 | isVideoChannelSupportValid |
06a05d5f | 25 | } |