-
Notifications
You must be signed in to change notification settings - Fork 5
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
Allow for deep get/set based on . separated keys #31
Comments
Thew store is a key/value map, so you should create another function like A solution could be to use destructuring, like this
however this could cause
but this is not really readable. Another solution is writing a custom function that extracts the nested properties
This code is just an idea, you should add proper checks to avoid infinite loops and type errors if some nested properties are missing or undefined |
Yeah, that was the reason I opened the issue, to get your opinion on it. I have no problem creating a fork with the new functionality and issuing a PR. As for creating the new function, while it is a breaking change to parse strings like I'm going to create a fork and update/add the functionality I need. Will issue a PR and get your thoughts on it. Great job on the repo! |
Thanks, |
Ahh, i read your updated article but didn't realize you created a new repo for it. Will check it out. |
Often times I want to update a property a few levels down an object. Instead of having to pull the object from the store, update the key, and set it back to the store, we could allow for parsing of the passed in key to deep get/set a property.
Example:
Same idea for a deep set. Unless there is some philosophical reason for keeping store access single level, this could be a nice enhancement.
The text was updated successfully, but these errors were encountered: