If I want to check for a specific (nested) object value, I can do this by
if (configuration?.my_project?.frontend?.version)
instead of
if (
configuration &&
configuration.my_project &&
configuration.my_project.frontend &&
configuration.my_project.frontend.version
)
But how do I handle this if I want to do this for dynamic keys using variables?
configuration[project][app].version
would fail for { my_project: {} } as there is no frontend.
So if I want to check if version is missing for a specific app in a specific project, I'm going this way:
if (
configuration &&
configuration[project] &&
configuration[project][app] &&
!configuration[project][app].version
)
The only part I see is just !configuration[project][app]?.version, but this would also fail for { my_project: {} }