I would like to use property value shorthand but only when the value is defined, consider the following example:
const personByName = name => {
const person = http(name)
return { person, method: 'byName' }
}
personByName('john') // found person: { person: { name: 'john', age: 30 }, method: 'byName' }
personByName('paul') // not found: { method: 'byName' }
But the current output I get is:
personByName('paul') // not found: { person: undefined, method: 'byName' }