title: How to merge or groupBy toPromise via RxJs?
body: <p>I have the following method that returns result as shown below:</p>
  <pre><code>result: [ { status: 200, ... }, { status: 200, ... }, { status: 400, ... }, ... ]
      
  </code></pre>
  <p>I need to group the result by using status value and return only 2 results instead of 3 for the example result above:</p>
  <pre><code>update() {
    this.demoService.update(...).toPromise()
    .then(result =&gt; {
  
      const message = result.map((x: any) =&gt; {
        if (x.status === 200) {
          return {
            text: 'successful'
          };
        } else {
          return {
            text: 'fail'
          };
        }
      });
  
      }
    })
  }
  </code></pre>
  <p>I tried to use <code>groupBy</code> of RxJs but I think it cannot be used in Promise. So, how can I group this result in the example above?</p>