semaphore
semaphore copied to clipboard
fix: Replace map with forEach to avoid unnecessary array creation
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
- [x] I have performed a self-review of my code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] My changes generate no new warnings
- [x] I have run
yarn formatandyarn lintwithout getting any errors - [x] I have added tests that prove my fix is effective or that my feature works
- [x] New and existing unit tests pass locally with my changes