Hacker News new | ask | show | jobs
by archduck 1500 days ago
This ain’t pretty, but it works:

  [
    “foo”,
    ...(cond1 ? [bar] : []),
    ...(cond2 ? baz : []),
  ]
---

Edit: note to self: read the link before commenting.