Add property to object when it's not null
<p>I'm working on a small API and I want to update the data using <code>HTTP PATCH REQUEST</code> without using a bunch of if statements. I'm trying to fill the outgoing data object with the changed data only.</p>

<pre><code>update() {
    let prop1 = hasBeenChanged.prop1 ? changedData.prop1 : null;
    // ...
    let propN = hasBeenChanged.propN ? changedData.propN : null;

    let data: ISomething = {
        // something like --&gt; property != null ? property: property.value : nothing
    }
}
</code></pre>

<p>Is there any way to create the data object dynamically? </p>