PeerTube/server/helpers/custom-validators/video-comments.ts
Chocobozzz 10363c74c1
Move middleware utils in middlewares
helpers modules should not import models
2021-06-03 18:03:36 +02:00

15 lines
442 B
TypeScript

import validator from 'validator'
import { CONSTRAINTS_FIELDS } from '../../initializers/constants'
const VIDEO_COMMENTS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_COMMENTS
function isValidVideoCommentText (value: string) {
return value === null || validator.isLength(value, VIDEO_COMMENTS_CONSTRAINTS_FIELDS.TEXT)
}
// ---------------------------------------------------------------------------
export {
isValidVideoCommentText
}