Skip to content
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

Map keys with dots are interpreted as paths. #22

Closed
Flamenco opened this issue Dec 14, 2017 · 2 comments
Closed

Map keys with dots are interpreted as paths. #22

Flamenco opened this issue Dec 14, 2017 · 2 comments

Comments

@Flamenco
Copy link
Contributor

I am trying to not use a property array for addressing a map with string/dot keys.
I am writing a patch to address this. Please respond with your thoughts....

const state = {
 "map" : { 
 "http://foo.bar" : 1,
 "http://me.you" : 2
 }
}

I can't address the keys with dots.

Solution #1 Use Brackets

dotProp.set(state, "map['http://foo.bar']", 3)

Solution #2A Escape Dots With Backslash

dotProp.set(state, "map.http://foo\\.bar", 3)

Solution #2B Escape Dots With Dot

dotProp.set(state, "map.http://foo..bar", 3)

Solution #3 Use quotes/apostrophes

dotProp.set(state, 'map."http://foo.bar"', 3)
@cluk3
Copy link
Contributor

cluk3 commented Dec 30, 2017

this commit 9d5602e is already solving your issue, using the solution n2

@hilleer
Copy link
Member

hilleer commented Aug 23, 2019

The commit @cluk3 suggested to have implemented this already does seem to have so.

@Flamenco please comment here if the implementation is in fact not a solution to your request.

@hilleer hilleer closed this as completed Aug 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants