title: How to handle the if-else in promise then?
body: <p>In some case, when I get a return value from a promise object, I need to start two different <code>then()</code> precesses depend on the value's condition, like:</p>
  
  <pre><code>promise().then(function(value){
      if(//true) {
          // do something
      } else {
          // do something 
      }
  })
  </code></pre>
  
  <p>I'm thinking maybe I can write it like:</p>
  
  <pre><code>promise().then(function(value){
      if(//true) {
          // call a new function which will return a new promise object
          ifTruePromise().then();
      } else {
          ifFalsePromise().then();
      }
  })
  </code></pre>
  
  <p>but with this, I have two questions:</p>
  
  <ol>
  <li><p>I'm not sure if it's a good idea to start a new promise-then process in a promise;</p></li>
  <li><p>what if I need the two process to call one function in the last? It means they have the same "terminal"</p></li>
  </ol>
  
  <p>I tried to return the new promise to keep the original chain like:</p>
  
  <pre><code>promise().then(function(value){
      if(//true) {
          // call a new function which will return a new promise object
          // and return it
          return ifTruePromise();
      } else {
          // do something, no new promise
          // hope to stop the then chain
      }
  }).then(// I can handle the result of ifTruePromise here now);
  </code></pre>
  
  <p>but in this case, whether it's true or false, the next <code>then</code> will work.</p>
  
  <p>SO, what's the best practice to handle it?</p>