Fastify/5/Req Params HasOwnProperty To ObjectHasOwn
This codemod turns req.params.hasOwnProperty('name')
into Object.hasOwn(req.params, 'name')
, reflecting the new Fastify v5 approach to property checking.
Before
fastify.get('/route/:name', (req, reply) => {console.log(req.params.hasOwnProperty('name')); // truereturn { hello: req.params.name };});
After
fastify.get('/route/:name', (req, reply) => {console.log(Object.hasOwn(req.params, 'name')); // truereturn { hello: req.params.name };});
Build custom codemods
Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community