title: Assign, and set js object property conditionally
body: <p>Here's my code: </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>app.post('/ujfeladat', (req, res) =&gt; {
      const {nev, tipus, szid} = req.body;
      const hianyos = () =&gt; {
          if(tipus === 'hianyos'){
              return {rang: -1}
          }
          return
      }
      db('fl').insert({
          nev: nev,
          tipus: tipus,
          szid: szid,
          hianyos() //returns an error
      }).returning('*')
      .then(data =&gt; res.json(data))
      .catch(err =&gt; console.log(err))
  })</code></pre>
  </div>
  </div>
  </p>
  
  <p>How can i do that to add the <code>rang</code> property to the object only if the <code>tipus === 'hianyos'</code>?</p>