-
Notifications
You must be signed in to change notification settings - Fork 32
Description
I'm having an issue with the coerce functionality. The way I see it, this function does three things: type conversion, filling in defaults, and filling in required properties. When I use the coerce function, I sometimes want type conversion, I always want defaults, and I never want filling in required properties. One way to deal with this would be to add an options parameter the coerce function. This would allow the user to fine tune the coerce features that are applied. Another approach would be to factor each of the coercion features out in separate public functions. Developers could then use those functions to coerce their data how they want before passing it to the validate function. The coerce function would use these functions internally. What do you think?