Is there an operator (in lodash etc) that can clean up this conditional expression?
if (foo && foo.bar && foo.bar.baz !== '') { .... }
Yes, you can use the optional chaining operator as follows:
if (foo?.bar?.baz !== '') { .... }