]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/helpers/custom-validators/pods.ts
Fix client compilation
[github/Chocobozzz/PeerTube.git] / server / helpers / custom-validators / pods.ts
index ee939ad04b0053722fd281d7ab12a98326ec5066..ec9f26cc8444caab3671f06870f4fc31ea8ed488 100644 (file)
@@ -1,12 +1,12 @@
 import * as validator from 'validator'
 
-import { isArray } from './misc'
+import { isArray, exists } from './misc'
 
-function isHostValid (host) {
-  return validator.isURL(host) && host.split('://').length === 1
+function isHostValid (host: string) {
+  return exists(host) && validator.isURL(host) && host.split('://').length === 1
 }
 
-function isEachUniqueHostValid (hosts) {
+function isEachUniqueHostValid (hosts: string[]) {
   return isArray(hosts) &&
     hosts.length !== 0 &&
     hosts.every(function (host) {
@@ -20,3 +20,12 @@ export {
   isEachUniqueHostValid,
   isHostValid
 }
+
+declare global {
+  namespace ExpressValidator {
+    export interface Validator {
+      isEachUniqueHostValid
+      isHostValid
+    }
+  }
+}