lib/download.js
function(url) {
    var protocol;
    if (url.indexOf('http://') !== -1) {
      protocol = http;
    } else if (url.indexOf('https://') !== -1) {
      protocol = https;
    } else {
      throw new Error('unsupported protocol :' + url);
    }

    return protocol;
  }
function(url) {
    var protocol;
    if (url.indexOf('http://') !== -1) {
      protocol = http;
    } else if (url.indexOf('https://') !== -1) {
      protocol = https;
    } else {
      throw new Error('unsupported protocol :' + url);
    }

    return protocol;
  }
function ( url ) { var protocol ; if ( url . indexOf ( 'http://' ) !== - 1 ) { protocol = http ; } else if ( url . indexOf ( 'https://' ) !== - 1 ) { protocol = https ; } else { throw new Error ( 'unsupported protocol :' + url ) ; } return protocol ; }
Choose a protocol for the url.

@param {string} url some url.
@return {Object} http or https.
Choose a protocol for the url .