title: Better way to create an object from an object of properties?
body: <p>In my app, I'm creating several different objects using data from an API request as follows:</p>
  
  <pre><code>const newRelationship = new Relationship(
      data.id,
      data.account_id,
      data.name,
      data.description,
      data.created_at,
      data.created_by,
      data.deleted_at,
      data.deleted_by,
      data.updated_at,
      data.updated_by,
  );
  </code></pre>
  
  <p>This feels a bit cumbersome. Is there a better (one line) way to do this, rather than writing out all the parameters by hand like this?</p>
  
  <p>I'm hoping for something like below but I'm not 100% on spread/destructuring yet.</p>
  
  <pre><code>const newRelationship = new Relationship(...data);
  </code></pre>
  
  <p>My Relationship constructor is as follows:</p>
  
  <pre><code>constructor(id, accountId, name, description, createdAt, createdBy, updatedAt, updatedBy, deletedAt, deletedBy) {
      this.id = id || '';
      this.accountId = accountId || '';
      this.name = name || '';
      this.description = description || '';
      this.createdAt = createdAt || '';
      this.createdBy = createdBy || '';
      this.deletedAt = deletedAt || '';
      this.deletedBy = deletedBy || '';
      this.updatedAt = updatedAt || '';
      this.updatedBy = updatedBy || '';
  }
  </code></pre>