How can i recursively search a nested object to find the PATH to an object reference I'm providing?
My original object looks like:
a = {
b: [
{ children: [...more objects] },
{ children: [] }
etc..
],
c: [
{ children: [...more objects] },
{ children: [] }
etc..
]
}
I would like to call a function findDeepAndStorePath(a, obj)
which would find the object reference and store the path to it in an array of indexes such as: ['b', 0, 1, 2].