title: Alternative for nested If else statements in typescript or javascript otherthan switch and ternary operator
body: <p>Currently I am using ESLint to reduce the complexity of code, so in order to that I want to reduce my if-else code into less complexity. I have the following code.</p>
  <pre><code>if (sortBy.length &amp;&amp; sortBy == 'updated_at') {
       createQuery
       .distinctOn(['adjustments.updated_at', 'adjustments.id'])
       .orderBy('adjustments.updated_at', order &amp;&amp; order.length ? order :  
       DESC')
       .addOrderBy('adjustments.id', order &amp;&amp; order.length ? order : 
       'DESC');
  } else if (sortBy.length &amp;&amp; sortBy == 'default_priority') {
              createQuery
              .distinctOn(['adjustments.default_priority', 
              'adjustments.id', 'adjustments.priority_action_value'])
              .orderBy('adjustments.default_priority', order &amp;&amp; 
              order.length ? order : 'DESC')
             .addOrderBy('adjustments.priority_action_value', 'DESC');
     } else {
           createQuery
           .distinctOn(['adjustments.created_at', 'adjustments.id'])
           .orderBy('adjustments.created_at', order &amp;&amp; order.length ? 
           order : 'DESC')
           .addOrderBy('adjustments.id', order &amp;&amp; order.length ? order 
           : 'DESC');
      }
  </code></pre>