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

fix: Replace map with forEach to avoid unnecessary array creation #940

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mdqst
Copy link
Contributor

@mdqst mdqst commented Jan 18, 2025

Description

map was used instead of forEach in the code. Since map creates a new array that isn't being used, it can be misleading and is considered an anti-pattern.

I've replaced it with forEach to make the intent clearer and avoid unnecessary overhead.

Checklist

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have run yarn format and yarn lint without getting any errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Copy link
Member

@vplasencia vplasencia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @mdqst! Thank you very much for this PR.

Could you run yarn format:write and push the changes?

Could you update the other scripts that are in the same folder of this file following the same idea?

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

Successfully merging this pull request may close these issues.

2 participants