function countFilteredLaps(
  filteredSegmentIds,
  definitionSet,
) {
  const lapRegex = new RegExp(definitionSet.join(','), 'g');
  const matches = filteredSegmentIds.join(',').match(lapRegex) || [];
  return matches.length;
}
/**
 * Counts laps from segment IDs that have been filtered to include
 * definition start-mid-end segments
 *
 * @param {Array} filteredSegmentIds Array of segment IDs
 * @param {Array} definitionSegments Segment IDs defining a lap from a single entry point
 * @param {Number} definitionSegments[0] ID of start segment
 * @param {Number} definitionSegments[1] ID of middle segment
 * @param {Number} definitionSegments[2] ID of end segment
 * @returns {Number} Number of laps completed
 */
Counts laps from segment IDs that have been filtered to include
definition start-mid-end segments


Counts laps from segment IDs that have been filtered to include definition start - mid - end segments
function countFilteredLaps(
  filteredSegmentIds,
  definitionSet,
) {
  const lapRegex = new RegExp(definitionSet.join(','), 'g');
  const matches = filteredSegmentIds.join(',').match(lapRegex) || [];
  return matches.length;
}
function countFilteredLaps ( filteredSegmentIds , definitionSet , ) { const lapRegex = new RegExp ( definitionSet . join ( ',' ) , 'g' ) ; const matches = filteredSegmentIds . join ( ',' ) . match ( lapRegex ) || [ ] ; return matches . length ; }
Counts laps from segment IDs that have been filtered to include
 definition start-mid-end segments
Counts laps from segment IDs that have been filtered to include definition start - mid - end segments