]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/helpers/custom-validators/misc.ts
Add videos list filters
[github/Chocobozzz/PeerTube.git] / server / helpers / custom-validators / misc.ts
index 455aae3674f992317161816b2fa9a0f289cae307..151fc852bae5d24c6ab99db14482a728859c9576 100644 (file)
@@ -41,6 +41,12 @@ function toValueOrNull (value: string) {
   return value
 }
 
+function toArray (value: string) {
+  if (value && isArray(value) === false) return [ value ]
+
+  return value
+}
+
 function isFileValid (
   files: { [ fieldname: string ]: Express.Multer.File[] } | Express.Multer.File[],
   mimeTypeRegex: string,
@@ -80,5 +86,6 @@ export {
   toValueOrNull,
   isBooleanValid,
   toIntOrNull,
+  toArray,
   isFileValid
 }