src/lib/metrics.js
// Remove all points older than `cutoff`, return the number of removed elements
Remove all points older than `cutoff`, return the number of removed elements
Remove all points older than ` cutoff ` return the number of removed elements
function gcPoints(points, cutoff) {
  const l = points.length;
  for (var i = 0; i < l; i++) {
    if (points[i][0] >= cutoff) {
      return points.splice(0, i).length;
    }
  }
  if (i === l) {
    points.splice(0, l);
    return l;
  }
  return 0;
}
function gcPoints ( points , cutoff ) { const l = points . length ; for ( var i = 0 ; i < l ; i ++ ) { if ( points [ i ] [ 0 ] >= cutoff ) { return points . splice ( 0 , i ) . length ; } } if ( i === l ) { points . splice ( 0 , l ) ; return l ; } return 0 ; }
Remove all points older than `cutoff`, return the number of removed elements
Remove all points older than ` cutoff ` return the number of removed elements