ether / ep_comments_page

Comments in Etherpad - No Longer Highly Experimental, now highly awesome!
Apache License 2.0
42 stars 48 forks source link

Ref: remove underscore dependency #263

Open HMarzban opened 2 years ago

HMarzban commented 2 years ago

Remove underscore dependency for this function:

EpComments.prototype.buildComments = function (commentsData) {
  const comments =
    _.map(commentsData, (commentData, commentId) => this.buildComment(commentId, commentData.data));
  return comments;
};

TO

EpComments.prototype.buildComments = function (commentsData) {
  const comments = [];
  for (const commentId in commentsData) {
      if (!Object.hasOwn(commentsData, commentId)) {
          const newComment = this.buildComment(commentId, commentData.data);
          comments.push(newComment)
      }
  }
  return comments;
};