eclipse-paho / eclipse-paho/paho.mqtt.javascript
refactor: replace "for" loops with Array.prototype.* methods as appropriate
- Dominant language
- JavaScript
- Stars
- 1.2k
- Forks
- 466
- PR merge metrics
- No merged PRs in 30d
Description
Using `for` loops (with the exception of `for..of`) in JS nowadays is discouraged. Generally, anything that can be expressed as a `for` loop can be better expressed declaratively using `Array.prototype` methods ("you need to iterate over an array--but you don't need to tell JS how to do so").
Replace `for` loops with `Array.prototype` methods such as `forEach`, `map`, etc., as appropriate.
Contributor guide
Research direction
The issue names no files or tests. Search the JavaScript source for `for` loops, excluding `for..of`, and determine which Array.prototype method fits each loop while preserving behavior. Run the project's existing tests afterward; done means applicable loops are refactored and the tests still pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- networking
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100