dlv icon indicating copy to clipboard operation
dlv copied to clipboard

Feature request: ability to escape dot in the key string

Open vanodevium opened this issue 1 year ago • 2 comments

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

vanodevium avatar Jul 05 '24 18:07 vanodevium

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

trijpstra-fourlights avatar Jan 20 '25 11:01 trijpstra-fourlights

@trijpstra-fourlights I know, I know

vanodevium avatar Jan 20 '25 12:01 vanodevium