]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/helpers/custom-validators/misc.ts
Search channels against handles and not names
[github/Chocobozzz/PeerTube.git] / server / helpers / custom-validators / misc.ts
index f8f168149e9cfeb7078e40d43eb725896ee74bc4..c19a3e5eba2692e7f1e87075d20509ede9bba365 100644 (file)
@@ -23,6 +23,10 @@ function isNotEmptyIntArray (value: any) {
   return Array.isArray(value) && value.every(v => validator.isInt('' + v)) && value.length !== 0
 }
 
+function isNotEmptyStringArray (value: any) {
+  return Array.isArray(value) && value.every(v => typeof v === 'string' && v.length !== 0) && value.length !== 0
+}
+
 function isArrayOf (value: any, validator: (value: any) => boolean) {
   return isArray(value) && value.every(v => validator(v))
 }
@@ -187,6 +191,7 @@ export {
   isIntOrNull,
   isIdValid,
   isSafePath,
+  isNotEmptyStringArray,
   isUUIDValid,
   toCompleteUUIDs,
   toCompleteUUID,