-
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
Adding optional "converter" function for validating/converting types. #574
Comments
Edit: Back near keyboard, so updated sample code to reflect this change. |
Don't go too far into this feature, it might be done otherwise. |
Yeah, no worries. Just had some time to work on it so I put together a PR, but I won't be heartbroken if it gets closed. |
Please look at #577 and see if it covers your needs. I'll close the PR as well. |
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. |
I apologize if this has been discussed in the past (couldn't find a related issue), but just filing this to see if there's an appetite for some version of this functionality. If so, I'm happy to do the work.
The proposal is to add
convert
support to thetype
validator by adding an optional converter function to the signature:type(constructor, [name], [converter]);
The converter function would have the form:
A sample back-of-napkin implementation may look like:
SAMPLE REDACTED
Edit: Sample code was woefully incorrect and out of date. Working branch is here.
The text was updated successfully, but these errors were encountered: