lib/search.js
function(params) {

  var baseUrl = 'http://www.omdbapi.com/';
  var query = '?';
  
  // mandatory
  query += 's='.concat(encodeURIComponent(params.query));
  
  if (params.year) {
    query += '&y='.concat(params.year);
  }

  if (params.type) {
    query += '&type='.concat(params.type);
  }

  if (params.apiKey) {
    query += '&apikey='.concat(params.apiKey);
  }
  
  return baseUrl.concat(query, '&r=json&v=1');
}
function(params) {

  var baseUrl = 'http://www.omdbapi.com/';
  var query = '?';
  
  // mandatory
  query += 's='.concat(encodeURIComponent(params.query));
  
  if (params.year) {
    query += '&y='.concat(params.year);
  }

  if (params.type) {
    query += '&type='.concat(params.type);
  }

  if (params.apiKey) {
    query += '&apikey='.concat(params.apiKey);
  }
  
  return baseUrl.concat(query, '&r=json&v=1');
}
function ( params ) { var baseUrl = 'http://www.omdbapi.com/' ; var query = '?' ; // mandatory query += 's=' . concat ( encodeURIComponent ( params . query ) ) ; if ( params . year ) { query += '&y=' . concat ( params . year ) ; } if ( params . type ) { query += '&type=' . concat ( params . type ) ; } if ( params . apiKey ) { query += '&apikey=' . concat ( params . apiKey ) ; } return baseUrl . concat ( query , '&r=json&v=1' ) ; }
Build the url string from the parameters.

@param {Object} params
@return {String} url to call omdbapi.com
@api private
Build the url string from the parameters .