Okay, so with ES11 I can now replace:
const name = _.get(response, 'data.options.name');
with:
const name = response?.data?.options?.name;
But how can I use do this, if 'data.options.name' is passed as variable?
For example, how can I easily (one-line) replace lodash in the following case?
async someFunc(doc, path) {
let prop = _.get(doc, path);
if (prop) {
await doSomethingUseful(prop);
}
}