-
Notifications
You must be signed in to change notification settings - Fork 46
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
validate shape of Map #15
Comments
I have this question too. |
If it contains specific keys/values, then isn't it a Map or a Map descendant by default? What would be the scenario where you want to verify specific key/values and specifically care about the implementing class? And sorry for the delay. I recently changed jobs and moved from the east coast to the west... ie. I have been a bad project maintainer. |
You can apply the same logic as used in React PropTypes. Look at this SO question for the how, and refer to #17 for making sure you realize you will get a normal JS type. |
I think the SO question actually references a slightly different problem, ie verifying that something is a |
@HurricaneJames to generalize a little more, the SO questions asks about how you can verify type and/or format of the keys of a map, not just the values of those keys. |
please check out PR #24 to see if it fits the requested functionality |
This should be addressed by #24, which has been merged/published as v1.7.0. |
Currently, I can either validate that something is a
Map
or that somethingcontains
specific keys/values.Can I do both at the same time?
I want to validate that something is an immutable Map with specific keys, which have values of specific types.
At first, I had an idea that
mapOf
would do the thing, but it validates each of map's values against pattern.The text was updated successfully, but these errors were encountered: