【JavaScript】条件を満たす場合のみオブジェクトにプロパティを追加する

忘れがちでよく検索するのでメモ。

const a = {
  ...(someCondition && { b: 5 }),
};

References