Skip to content

vue-doctor/performance/js-combine-iterations ​

Fuse long .filter().map().filter() chains, or chains that run inside a loop, into one .reduce() or for...of pass

PropertyValue
CategoryPerformance
Default Severitywarning
Confidencemedium
FixableNo
Engineoxlint
Sincev1.0.0
Frameworksvue, nuxt
Test filesNot checked (which files)

Why it matters ​

Fuse long .filter().map().filter() chains, or chains that run inside a loop, into one .reduce() or for...of pass

How to fix ​

Review the finding and update the code according to best practices below.

Agent Guidance ​

Only chains of three or more iteration methods, or chains evaluated on every iteration of a loop or array callback, are reported. Fuse them into one pass with for...of or .reduce(), preserving the order of side effects. A single .map().filter() over a small array costs microseconds and is better left readable.


Rule source: vue-doctor/performance/js-combine-iterations

Released under the MIT License.