@E18e/Is Odd

1.0.5Last update Aug 9, 2024
by@e18e

is-odd Codemod

Introduction

This codemod replaces the use of the is-odd npm module with a more efficient built-in JavaScript expression. It transforms function calls to is-odd into a binary expression that checks if a number is odd, thus reducing unnecessary dependencies and improving performance.

Before

import { isOdd } from 'is-odd';
const result = isOdd(5);

After

const result = (5 % 2) !== 0;

Build custom codemods

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

background illustrationGet Started Now