function filterBySets(matches) {
  const setsFilters = {
    "equals": player => player.set.length == setsValue,
    "greater-than": player => player.set.length > setsValue,
    "less-than": player => player.set.length < setsValue,
    "none": player => true,
  };

  var setsValue = $("#sets-value").val();
  var setsCondition = $("#sets-condition").val();
  if (!setsValue) {
      setsCondition = "none";
  }

  const setsFilter = setsFilters[setsCondition];

  console.log("Filter by sets (" + setsCondition + " " + setsValue + "): " + setsFilter);

  return matches.filter(match => match.player.find(setsFilter));
}
// Filter tournament matches by number of sets
Filter tournament matches by number of sets
Filter tournament matches by number of sets
function filterBySets(matches) {
  const setsFilters = {
    "equals": player => player.set.length == setsValue,
    "greater-than": player => player.set.length > setsValue,
    "less-than": player => player.set.length < setsValue,
    "none": player => true,
  };
  var setsValue = $("#sets-value").val();
  var setsCondition = $("#sets-condition").val();
  if (!setsValue) {
      setsCondition = "none";
  }
  const setsFilter = setsFilters[setsCondition];
  console.log("Filter by sets (" + setsCondition + " " + setsValue + "): " + setsFilter);
  return matches.filter(match => match.player.find(setsFilter));
}
function filterBySets ( matches ) { const setsFilters = { "equals" : player => player . set . length == setsValue , "greater-than" : player => player . set . length > setsValue , "less-than" : player => player . set . length < setsValue , "none" : player => true , } ; var setsValue = $ ( "#sets-value" ) . val ( ) ; var setsCondition = $ ( "#sets-condition" ) . val ( ) ; if ( ! setsValue ) { setsCondition = "none" ; } const setsFilter = setsFilters [ setsCondition ] ; console . log ( "Filter by sets (" + setsCondition + " " + setsValue + "): " + setsFilter ) ; return matches . filter ( match => match . player . find ( setsFilter ) ) ; }
Filter tournament matches by number of sets
Filter tournament matches by number of sets