ducktype.js
function isUrl(string){
    if (typeof string !== 'string') {
      return false;
    }

    var match = string.match(protocolAndDomainRE);
    if (!match) {
      return false;
    }

    var everythingAfterProtocol = match[1];
    if (!everythingAfterProtocol) {
      return false;
    }

    return localhostDomainRE.test(everythingAfterProtocol) ||
        nonLocalhostDomainRE.test(everythingAfterProtocol);
  }
function isUrl(string){
    if (typeof string !== 'string') {
      return false;
    }

    var match = string.match(protocolAndDomainRE);
    if (!match) {
      return false;
    }

    var everythingAfterProtocol = match[1];
    if (!everythingAfterProtocol) {
      return false;
    }

    return localhostDomainRE.test(everythingAfterProtocol) ||
        nonLocalhostDomainRE.test(everythingAfterProtocol);
  }
function isUrl ( string ) { if ( typeof string !== 'string' ) { return false ; } var match = string . match ( protocolAndDomainRE ) ; if ( ! match ) { return false ; } var everythingAfterProtocol = match [ 1 ] ; if ( ! everythingAfterProtocol ) { return false ; } return localhostDomainRE . test ( everythingAfterProtocol ) || nonLocalhostDomainRE . test ( everythingAfterProtocol ) ; }
Loosely validate a URL `string`.

Source: https://github.com/segmentio/is-url

@param {String} string
@return {Boolean}
Loosely validate a URL string .