1 import * as validator from 'validator'
3 import { isArray, exists } from './misc'
5 function isHostValid (host: string) {
6 return exists(host) && validator.isURL(host) && host.split('://').length === 1
9 function isEachUniqueHostValid (hosts: string[]) {
10 return isArray(hosts) &&
12 hosts.every(function (host) {
13 return isHostValid(host) && hosts.indexOf(host) === hosts.lastIndexOf(host)
17 // ---------------------------------------------------------------------------
20 isEachUniqueHostValid,
25 namespace ExpressValidator {
26 export interface Validator {