-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
featureNew functionality or improvementNew functionality or improvement
Milestone
Description
joi => ({
name: 'customregex',
base: joi.string().lowercase().min(20).regex(PARAM)
})I'm trying to extend the joi object using base, which works fine when static properties are assigned like .min(20), but how can I pass a param to .regex(PARAM) when calling this with joi.customregex(regexParam)?
It doesn't look like base can be a function so I don't see how it could work using just base.
I could create a validate function then use the params argument to manually check the regex myself, but then I'm duplicating the functionality of Joi's .regex() validator.
What's the recommended way to do this? The regex example is just an example, I'd like to use this method of extending joi in many different ways.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
featureNew functionality or improvementNew functionality or improvement