Let's say I have data
which is an object with some keys.
I also have context
and contextId
which both are string, but context
might be null or undefined.
How to created a new object that clones data
and adds data[context] = contextId
only to it when context
is not null or undefined in a one-liner using es6+.