title: How to skip promise in a chain
body: <p>I am working in a nodejs project and want to skip promise in a chain. Below is my code. In the first promise block, it will resolve a value <code>{success: true}</code>. On the second block I want to check the value of <code>success</code>, if true I want to return the value to the called and skip the rest of the promises in this chain; while continue the chain if the value is false. I know I can throw an error or reject it on the second block but I have to handle error case which it is not an error case. So how can I achieve this in promise chain? I need a solution without bring any other 3rd party library.</p>
  
  <pre><code>new Promise((resolve, reject)=&gt;{
      resolve({success:true});
  }).then((value)=&gt;{
      console.log('second block:', value);
      if(value.success){
          //skip the rest of promise in this chain and return the value to caller
          return value;
      }else{
          //do something else and continue next promise
      }
  }).then((value)=&gt;{
      console.log('3rd block:', value);
  });
  </code></pre>