aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-29 10:27:24 +0200
committerChocobozzz <me@florianbigard.com>2021-07-29 10:27:24 +0200
commitb033851fb54241bb703f86add025229e68cc6f59 (patch)
treed60dac1499a95bf9dc902dee24f325fe0f8b6acb /server/helpers/custom-validators
parentfbd67e7f386504e50f2504cb6386700a58906f16 (diff)
downloadPeerTube-b033851fb54241bb703f86add025229e68cc6f59.tar.gz
PeerTube-b033851fb54241bb703f86add025229e68cc6f59.tar.zst
PeerTube-b033851fb54241bb703f86add025229e68cc6f59.zip
Search channels against handles and not names
Diffstat (limited to 'server/helpers/custom-validators')
-rw-r--r--server/helpers/custom-validators/misc.ts5
1 files changed, 5 insertions, 0 deletions
diff --git a/server/helpers/custom-validators/misc.ts b/server/helpers/custom-validators/misc.ts
index f8f168149..c19a3e5eb 100644
--- a/server/helpers/custom-validators/misc.ts
+++ b/server/helpers/custom-validators/misc.ts
@@ -23,6 +23,10 @@ function isNotEmptyIntArray (value: any) {
23 return Array.isArray(value) && value.every(v => validator.isInt('' + v)) && value.length !== 0 23 return Array.isArray(value) && value.every(v => validator.isInt('' + v)) && value.length !== 0
24} 24}
25 25
26function isNotEmptyStringArray (value: any) {
27 return Array.isArray(value) && value.every(v => typeof v === 'string' && v.length !== 0) && value.length !== 0
28}
29
26function isArrayOf (value: any, validator: (value: any) => boolean) { 30function isArrayOf (value: any, validator: (value: any) => boolean) {
27 return isArray(value) && value.every(v => validator(v)) 31 return isArray(value) && value.every(v => validator(v))
28} 32}
@@ -187,6 +191,7 @@ export {
187 isIntOrNull, 191 isIntOrNull,
188 isIdValid, 192 isIdValid,
189 isSafePath, 193 isSafePath,
194 isNotEmptyStringArray,
190 isUUIDValid, 195 isUUIDValid,
191 toCompleteUUIDs, 196 toCompleteUUIDs,
192 toCompleteUUID, 197 toCompleteUUID,