@E18e/Array.Prototype.Indexof

1.0.5Last update Aug 9, 2024
by@e18e

Array.prototype.indexOf Codemod

Introduction

This codemod transforms calls to array.prototype.indexof (with a lowercase "o") to the built-in indexOf method of arrays. This replacement reduces reliance on error-prone custom implementations and leverages the native functionality, improving code performance and readability.

Before

const index = array.prototype.indexof(array, value);

After

const index = array.indexOf(value);

Build custom codemods

Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community

background illustrationGet Started Now