function categoryScoreMinOrMax(categoryId, type) {
  return lhrs => {
    const values = lhrs
      .map(lhr => lhr.categories[categoryId] && lhr.categories[categoryId].score)
      .filter(
        /** @return {value is number} */ value =>
          typeof value === 'number' && Number.isFinite(value)
      );

    if (!values.length) return {value: -1};
    return {value: Math[type](...values)};
  };
}
@param {string} categoryId
@param {'min'|'max'} type
@return {StatisticFn}