Array.prototype.flat Codemod
Introduction
This codemod replaces instances of the Array.prototype.flatten
method with the native Array.prototype.flat
method. The goal is to utilize built-in JavaScript features, reducing dependencies and improving performance in the codebase.
Before
const flattenedArray = array.flatten();
After
const flattenedArray = array.flat();
Build custom codemods
Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community