-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
featureNew functionality or improvementNew functionality or improvement
Milestone
Description
Context
- node version: 7.10.0
- joi version: 10.3.1
- environment (node, browser): node
- used with (hapi, standalone, ...): standalone
- any other relevant information:
Question
I use a schema in many place, such as
joi.object().keys({
user: joi.string().required(),
pwd: joi.string().required(),
})
but i don't like export it as a variable then import it to use. i want a easy way.
joi.object().userinfo()
I don't know how to implement by joi.extend(). But I use follow code:
joi.object().constructor.prototype['userinfo'] = function(){
return this.concat({
user: joi.string().required(),
pwd: joi.string().required(),
})
}
so anyone knows a elegance way??
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
featureNew functionality or improvementNew functionality or improvement