-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validate object constructor. #481
Conversation
|
||
Requires the object to be an instance of a given constructor where: | ||
- `constructor` - the constructor function that the object must be an instance of. | ||
- `name` - an alternate name to use in validation errors. This is useful when the constructor function dose not have a name. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo on dose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doh! Thanks.
Actually I think you should provide _test the name, not the constructor. This would give you the describe for free whereas now there's a special case to make to describe this properly. |
@Marsup after looking at it a bit, I'm not sure that I fully understand the purpose of |
Describe is an undocumented (so far) api that is used to output an object describing any joi object. It is used in lout and probably other projects. |
Cool, thanks! I think I have addressed all concerns now. Let me know if there's anything more that I can do. |
No more concerns, thanks a lot ! |
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions. |
Provides support for requiring an object to be an instance of a given constructor.
Closes #408.