Here's my code:
app.post('/ujfeladat', (req, res) => { const {nev, tipus, szid} = req.body; const hianyos = () => { if(tipus === 'hianyos'){ return {rang: -1} } return } db('fl').insert({ nev: nev, tipus: tipus, szid: szid, hianyos() //returns an error }).returning('*') .then(data => res.json(data)) .catch(err => console.log(err)) })
Here's how you can do it:
// Will result in { foo: 'foo', bar: 'bar'} const item = { foo: 'foo', ... true && { bar: 'bar' }, ... false && { falsy: 'falsy' }, } console.log(item)
1.4m articles
1.4m replys
5 comments
57.0k users