In my code, I deal with an array that has some entries with many objects nested inside one another, where as some do not. It looks something like the following:
If you use Babel, you can already use the optional chaining syntax with @babel/plugin-proposal-optional-chaining Babel plugin. This would allow you to replace this: