@Ariyaskumar If you’re doing this in a team environment and the functions get larger, one approach that helped us is defining a small config schema or using a validation library like zod or yup.
That way, you get both named parameters and structured validation without the manual checks.
js
Copy
Edit
import { z } from "zod";
const ParamsSchema = z.object({
param1: z.number(),
param2: z.number()
});
function myFunction(params) {
const validated = ParamsSchema.parse(params);
// safe to use param1 and param2 now
}
This helps a lot when multiple devs touch the same code and you want to avoid subtle bugs.
Everyone benefits from clearly defined expectations.