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

Fix missing top-level methods #934

Merged
merged 2 commits into from
Jun 27, 2016
Merged

Fix missing top-level methods #934

merged 2 commits into from
Jun 27, 2016

Conversation

joebalancio
Copy link
Contributor

This creates a custom Joi from an instance of the Any class instead of from an empty object. This allows the custom Joi to retain the properties and functions available on the original Joi object such as .when and .disallow.

This closes #933

@Marsup Marsup added the bug Bug or defect label Jun 26, 2016
@Marsup Marsup self-assigned this Jun 26, 2016
@Marsup Marsup added this to the 9.0.0 milestone Jun 26, 2016
@Marsup
Copy link
Collaborator

Marsup commented Jun 26, 2016

Nice catch ! I think we can solve this differently though, const joi = Object.create(this) feels like a nicer solution.

@joebalancio
Copy link
Contributor Author

The Object.create() method creates a new object with the specified prototype object and properties.
MDN

@Marsup Yes, that is much nicer. Thanks for the 👀 on this.

@Marsup Marsup changed the title Create extended Joi from a new instance of Any Fix missing top-level methods Jun 27, 2016
@Marsup Marsup merged commit 4300be9 into hapijs:master Jun 27, 2016
@joebalancio joebalancio deleted the patch-1 branch June 28, 2016 02:53
@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
bug Bug or defect
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extended Joi does not contain certain top-level functions
2 participants