It is too easy to write O(n^2) code using reduce, in fact I wrote an eslint rule to catch a common pattern I see other developers write.- <a href="https://github.com/romellem/eslint-plugin-no-spread-in-reduce" rel="nofollow">https://github.com/romellem/eslint-plugin-no-spread-in-reduc...It catches code that looks like this: items.reduce((acc, item) => { return { ...acc, [item.id]: item }; });
romellem · · focus · HN ↗
- <a href="https://github.com/romellem/eslint-plugin-no-spread-in-reduce" rel="nofollow">https://github.com/romellem/eslint-plugin-no-spread-in-reduc...
It catches code that looks like this: