String.prototype.substr Codemod
Introduction
This codemod replaces occurrences of the String.prototype.substr method with the more modern and preferred String.prototype.substring method. By doing so, it helps streamline the codebase, reduce reliance on deprecated features, and enhance readability.
Before
const stringValue = "Hello, World!";const substring = stringValue.substr(0, 5);
After
const stringValue = "Hello, World!";const substring = stringValue.substring(0, 5);
Build custom codemods
Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community