2 ms·
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. - https://github.com/r
by romellem 16d ago
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.
- https://github.com/romellem/eslint-plugin-no-spread-in-reduce 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
};
});