-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
bugBug or defectBug or defect
Milestone
Description
Context
- node version: 4.2.3
- joi version: 9.0.0-6
- environment (node, browser): node
- used with (hapi, standalone, ...): standalone
- any other relevant information:
What are you trying to achieve or the steps to reproduce ?
- Extend Joi using
joi.extend. See example below - Top-level functions like
.whenand.disallowdo not exist
I think this happens because Joi is cloned from Any whereas the Extended Joi is assigned the enumerable properties from Joi.
example
const Custom = Joi.extend({
name: 'newType'
})
console.log(Custom.when) // undefinedWhich result you had ?
The new type exists on the extended Joi, but the top-level functions like Joi.when and Joi.disallow do not exist.
What did you expect ?
I expected those functions to exist.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugBug or defectBug or defect