Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ref: remove underscore dependency #263

Open
HMarzban opened this issue Jul 25, 2022 · 0 comments
Open

Ref: remove underscore dependency #263

HMarzban opened this issue Jul 25, 2022 · 0 comments

Comments

@HMarzban
Copy link

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;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant