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

/icons/calendar.svg

Last update

Aug 24, 2024

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