Adicione condicionalmente membros a um objeto
const condition = true
const obj = Object.assign({}, condition ? {
b: 5
} : null)
console.log(obj)
Prickly Partridge
const condition = true
const obj = Object.assign({}, condition ? {
b: 5
} : null)
console.log(obj)