dist/bundle.js
function addReview(reviews, review) {
  if (!reviews.length) {
    return [review];
  }

  var i = reviews.length - 1;
  for (; i >= 0; i -= 1) {
    if (reviews[i].ts <= review.ts) {
      break;
    }
  }

  var newReviews = reviews.slice(0);
  newReviews.splice(i + 1, 0, review);

  return newReviews;
}
function addReview(reviews, review) {
  if (!reviews.length) {
    return [review];
  }

  var i = reviews.length - 1;
  for (; i >= 0; i -= 1) {
    if (reviews[i].ts <= review.ts) {
      break;
    }
  }

  var newReviews = reviews.slice(0);
  newReviews.splice(i + 1, 0, review);

  return newReviews;
}
function addReview ( reviews , review ) { if ( ! reviews . length ) { return [ review ] ; } var i = reviews . length - 1 ; for ( ; i >= 0 ; i -= 1 ) { if ( reviews [ i ] . ts <= review . ts ) { break ; } } var newReviews = reviews . slice ( 0 ) ; newReviews . splice ( i + 1 , 0 , review ) ; return newReviews ; }
This function only works if reviews is always sorted by timestamp
This function only works if reviews is always sorted by timestamp