api.js
function checkIfOnlyOneRequired (defaultParams) {
  var keys = Object.keys(defaultParams);
  var i, key;
  var onlyOne = '';
  
  for (i = 0; i < keys.length; i++){
    key = keys[i];
    if (defaultParams[key] === '') {
      if (onlyOne !== '') return false;
      onlyOne = key;
    }
  }
  
  return onlyOne;
}
function checkIfOnlyOneRequired (defaultParams) {
  var keys = Object.keys(defaultParams);
  var i, key;
  var onlyOne = '';
  
  for (i = 0; i < keys.length; i++){
    key = keys[i];
    if (defaultParams[key] === '') {
      if (onlyOne !== '') return false;
      onlyOne = key;
    }
  }
  
  return onlyOne;
}
function checkIfOnlyOneRequired ( defaultParams ) { var keys = Object . keys ( defaultParams ) ; var i , key ; var onlyOne = '' ; for ( i = 0 ; i < keys . length ; i ++ ) { key = keys [ i ] ; if ( defaultParams [ key ] === '' ) { if ( onlyOne !== '' ) return false ; onlyOne = key ; } } return onlyOne ; }
Check if default parameters has only one required param

Returns false if there are more than one, or a param name if there is only one
Check if default parameters has only one required param