ep_comments_page icon indicating copy to clipboard operation
ep_comments_page copied to clipboard

Ref: remove underscore dependency

Open HMarzban opened this issue 3 years ago • 0 comments

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;
};

HMarzban avatar Jul 25 '22 08:07 HMarzban