Codemod: Replace String.prototype.trimRight
with String.prototype.trimEnd
Introduction
This codemod replaces instances of String.prototype.trimRight
with the built-in String.prototype.trimEnd
method. This change not only reduces unnecessary dependencies by utilizing modern JavaScript features but also improves performance by leveraging native functionalities.
Before
const myString = " Hello, World! ";const trimmedString = myString.trimRight();
After
const myString = " Hello, World! ";const trimmedString = myString.trimEnd();
Build custom codemods
Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community