diff options
author | Chocobozzz <me@florianbigard.com> | 2022-08-17 15:36:03 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-08-17 15:36:03 +0200 |
commit | 690bb8f9f3413147a4f71d5ff0a3cd8170a94ce3 (patch) | |
tree | b16b8536acd2098aba8c1d6fe13a336dd6aa01a9 /server/helpers/custom-validators/videos.ts | |
parent | bbd5aa7ead5f1554a0872963f957effc26d8c630 (diff) | |
download | PeerTube-690bb8f9f3413147a4f71d5ff0a3cd8170a94ce3.tar.gz PeerTube-690bb8f9f3413147a4f71d5ff0a3cd8170a94ce3.tar.zst PeerTube-690bb8f9f3413147a4f71d5ff0a3cd8170a94ce3.zip |
Prefer using Object.values
Diffstat (limited to 'server/helpers/custom-validators/videos.ts')
-rw-r--r-- | server/helpers/custom-validators/videos.ts | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/server/helpers/custom-validators/videos.ts b/server/helpers/custom-validators/videos.ts index ca5f70fdc..3ebfe2937 100644 --- a/server/helpers/custom-validators/videos.ts +++ b/server/helpers/custom-validators/videos.ts | |||
@@ -1,5 +1,4 @@ | |||
1 | import { UploadFilesForCheck } from 'express' | 1 | import { UploadFilesForCheck } from 'express' |
2 | import { values } from 'lodash' | ||
3 | import magnetUtil from 'magnet-uri' | 2 | import magnetUtil from 'magnet-uri' |
4 | import validator from 'validator' | 3 | import validator from 'validator' |
5 | import { VideoFilter, VideoInclude, VideoPrivacy, VideoRateType } from '@shared/models' | 4 | import { VideoFilter, VideoInclude, VideoPrivacy, VideoRateType } from '@shared/models' |
@@ -78,8 +77,9 @@ function isVideoViewsValid (value: string) { | |||
78 | return exists(value) && validator.isInt(value + '', VIDEOS_CONSTRAINTS_FIELDS.VIEWS) | 77 | return exists(value) && validator.isInt(value + '', VIDEOS_CONSTRAINTS_FIELDS.VIEWS) |
79 | } | 78 | } |
80 | 79 | ||
80 | const ratingTypes = new Set(Object.values(VIDEO_RATE_TYPES)) | ||
81 | function isVideoRatingTypeValid (value: string) { | 81 | function isVideoRatingTypeValid (value: string) { |
82 | return value === 'none' || values(VIDEO_RATE_TYPES).includes(value as VideoRateType) | 82 | return value === 'none' || ratingTypes.has(value as VideoRateType) |
83 | } | 83 | } |
84 | 84 | ||
85 | function isVideoFileExtnameValid (value: string) { | 85 | function isVideoFileExtnameValid (value: string) { |