How do I create a function where a key of an object is dynamically set from the function
export const validateObjectId = (key: string = 'id'): ObjectSchema => {
return Joi.object({
key: Joi.string()
.regex(/^(?=[a-f\d]{24}$)(\d+[a-f]|[a-f]+\d)/i)
.required(),
});
};
how do I make the key be the key of the object