TypeScript/V5.6/Add Test For Regex In Conditional

1.0.3Last update Aug 24, 2024
by@alexbit-codemod

Add .test() to regex literals in conditionals

Before

if (/^[0-9]+$/) {
//some awesome code
}

After

if (/^[0-9]+$/.test('')) {
//some awesome code
}

Build custom codemods

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

background illustrationGet Started Now