You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This isn't a bad idea. Out-of-the-box interop with redux-form is very important, and it seems to support a validate function that returns a falsy value. However, this would be a breaking change, so I'm hesitant to immediately change this. Maybe some opt-in behavior for now via an option until the next major release would be a good middle ground.
You're totally right about the breaking change. Your solution sounds perfect to me.
The developers that depend on an empty object being present, can easily use the || operator to force this result. That's actually a pretty usual convention in the world of javascript. So it should feel familiar to them.
consterrors=dogValidator(dog)||{};// errors = {} when dogValidator returns null
Your solution of the extra option in the next release, and changing the default on the next major sounds awesome. Thanks!
Why not return
null
when there are no validation errors?That way we could do something like:
I'm aware of the assertion helpers, but in my opinion they shouldn't be really necessary.
The text was updated successfully, but these errors were encountered: