Skip to content
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

Merged
merged 1 commit into from
Nov 11, 2014
Merged

Validate object constructor. #481

merged 1 commit into from
Nov 11, 2014

Conversation

jagoda
Copy link
Contributor

@jagoda jagoda commented Nov 11, 2014

Provides support for requiring an object to be an instance of a given constructor.

Closes #408.


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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo on dose.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doh! Thanks.

@Marsup Marsup self-assigned this Nov 11, 2014
@Marsup Marsup added the feature New functionality or improvement label Nov 11, 2014
@Marsup Marsup added this to the 4.9.0 milestone Nov 11, 2014
@Marsup
Copy link
Collaborator

Marsup commented Nov 11, 2014

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.

@jagoda
Copy link
Contributor Author

jagoda commented Nov 11, 2014

@Marsup after looking at it a bit, I'm not sure that I fully understand the purpose of describe(). Could you can provide some context?

@Marsup
Copy link
Collaborator

Marsup commented Nov 11, 2014

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.

@jagoda
Copy link
Contributor Author

jagoda commented Nov 11, 2014

Cool, thanks! I think I have addressed all concerns now. Let me know if there's anything more that I can do.

@Marsup
Copy link
Collaborator

Marsup commented Nov 11, 2014

No more concerns, thanks a lot !

Marsup added a commit that referenced this pull request Nov 11, 2014
Validate object constructor.
@Marsup Marsup merged commit 2d48b4d into hapijs:master Nov 11, 2014
@lock
Copy link

lock bot commented Jan 9, 2020

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.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New functionality or improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Check if value is a RegEx
2 participants