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

Feature request: ability to escape dot in the key string #42

Open
vanodevium opened this issue Jul 5, 2024 · 2 comments
Open

Feature request: ability to escape dot in the key string #42

vanodevium opened this issue Jul 5, 2024 · 2 comments

Comments

@vanodevium
Copy link

const obj = {
	"a.b": {
        "c": 1
    }
}

There are cases when object keys already have a dot in the name.
It would be nice to be able to escape the dot so that the split will pass through.

So

dlv(obj, 'a\.b.c') === 1 // true
@trijpstra-fourlights
Copy link

trijpstra-fourlights commented Jan 20, 2025

For anyone encountering this issue: a workaround is to provide the lookup as an array

e.g.

const obj = {
    "a.b": {
        "c": 1
    }
}
dlv(obj, ['a.b', 'c']) === 1 // true

edit: wording

@vanodevium
Copy link
Author

@trijpstra-fourlights I know, I know

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

2 participants