js conditional object code example
Example 1: js conditional object property
const a = {
...(someCondition && {b: 5})
}
Example 2: js conditional object
const object = {
...bool && { foo: 2 },
}
const a = {
...(someCondition && {b: 5})
}
const object = {
...bool && { foo: 2 },
}