array.prototype.reduceright Codemod
Introduction
This codemod replaces the usage of the array.prototype.reduceright
npm module with the built-in reduceRight
method available on JavaScript arrays. By eliminating this dependency, we reduce the overall bundle size and enhance the performance of the codebase.
Before
import arrayPrototypeReduceright from 'array.prototype.reduceright';const result = arrayPrototypeReduceright([1, 2, 3], (acc, item) => acc + item);
After
const result = [1, 2, 3].reduceRight((acc, item) => acc + item);
Build custom codemods
Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community