-
-
Notifications
You must be signed in to change notification settings - Fork 106
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
generate objects from predicate #229
Comments
I should add that I'm asking this in the context of a JavaScript codebase that won't migrate to TypeScript anytime soon |
I think that's a bit out of scope for this package. Ow is meant for validation only. Also, it's ambiguous in many cases which would be the correct value to return. axis: ow.string.oneOf(['X', 'Y', 'Z']), A user might be fine with the first value there, but they also might want to specify a custom default. It's a slippery slope for API bloat. |
Yes it's ambigiguous and precisely the reason why I put it in my example 🙂 That being said, I did not meant for 'ow' to provide something like this. I know that 'ow' is for validation only, but I'm not on the TypeScript train with this code base, so when you're stuck with JavaScript, 'ow' is the closest thing I've found so far to have some type system that actually works & is easy to use (and if you know of a more appropriate project for this than 'ow', I'm all ears 😀 ) |
Hi !
Let's say I have objects representing a DB record and I wrote this to validate them
How can I use this to generate new empty records?
The idea would be to create a function that returns a correctly initialized object
The text was updated successfully, but these errors were encountered: