-
Notifications
You must be signed in to change notification settings - Fork 127
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
Further improve stringToPath
types; consolidate setPath
and pathOr
?
#632
Comments
Could also be worth it to explicitly state in documentation, that keys containing dots are not considered valid keys from |
Been thinking about this for a while and I think before we do anything, we should agree on a proper spec; so here is a rundown of some things I thought about and my proposals/RFCs - I'd like to get some feedback and discuss this, identify potential breaking changes and decide how to go about implementation, if you want to go forward with this. Let's start with
|
|
|
i doubt it's worth the effort supporting this on a typing-level, and it'd be a backwards-compatible change if we do decide to support it in the future. let's hold off on this for now and add it if someone requests
|
As discussed in #630 (review), it doesn't seem to make sense to support "dotted paths nested within bracket access", as e.g.
foo[bar.baz]
is not even a valid object path.The suggestion is to only allow integers inside brackets and also parse them out as numbers, as this is the format
setPath
expects.I'd agree with @cjquines that this doesn't need to be considered a breaking change, because the current version seems more like a bug than an intention (and also seems kind of useless in those specific cases).
On the other hand, if someone is relying on numeric indexes being parsed as strings instead of numbers, things could break.
Another question is whether
pathOr
shouldn't be brought "on par" withsetPath
, meaning supporting the same format of inputs, including at least somewhat arbitrary depths.Related: #355
The text was updated successfully, but these errors were encountered: