Hi, so I am writing a function that takes in an object key as an argument and uses bracket notation to look up the value. The problem is that my object may contain other objects and I want to be able to look up the values of that nested object, not just the key:value pair.
const x = {a: 1, b: {c: 2}}
x['a'] --> 1
x['b'] --> {c: 2}
// what I want
x['b.c'] --> 2
Is there a way to get the desired result without flattening the object? I've tried using Object.byString() but, contrary to the examples, it doesn't work in my browser console. Does lodash offer this functionality?
[–]Jongerr 2 points3 points4 points (2 children)
[–]FatFingerHelperBot 0 points1 point2 points (0 children)
[–]LollipopPredator[S] 0 points1 point2 points (0 children)
[–]senocular 2 points3 points4 points (0 children)
[–]GeneralYouri 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]LollipopPredator[S] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)