- Version: 8.5.0
- Platform: Windows 7 x64
- Subsystem: util
I am trying to make a simple object autovivification with Proxy:
functionautoVivify(){returnnewProxy({},{get(target,property){if(target[property]===undefined)target[property]=autoVivify();returntarget[property];},});}constobj=autoVivify();obj.a.b.c=1;console.log(obj);{ a: { b: { c: 1, [Symbol(util.inspect.custom)]: [Object] }, [Symbol(util.inspect.custom)]: { [Symbol(util.inspect.custom)]: [Object] } }, [Symbol(util.inspect.custom)]: { [Symbol(util.inspect.custom)]: { [Symbol(util.inspect.custom)]: [Object] } } }I understand that this is an edge case and maybe the output is correct. But I feel somehow that I should report this in case it is not completely intended. Feel free to close if it is by design.
I am trying to make a simple object autovivification with Proxy:
I understand that this is an edge case and maybe the output is correct. But I feel somehow that I should report this in case it is not completely intended. Feel free to close if it is by design.