title: RxJs 5 of.filter.mapTo operators -> RxJs 6
body: <p>I've inherited some old <code>RxJs 5</code> code that smells awkward:</p>
  <pre class="lang-js prettyprint-override"><code>  myFunc = (tag: TagModel): Observable&lt;TagModel&gt; =&gt; {
      try {
        const foundTag = this.mappedTags.find((x) =&gt; {
          return x.name === tag;
        });
        const isAllowedToAdd = foundTag ? false : true;
  
        return Observable
          .of(tag)
          .filter(() =&gt; isAllowedToAdd)
          .mapTo(tag);
  
      } catch (err) {
        console.log(&quot;err: &quot;, err);
      }
    }
  </code></pre>
  <p>Is the purpose of that code to create an Observable with either a value of tag if it's found, otherwise empty? It looks so convoluted (plus some other choice words which I can't share here).</p>
  <p><code>RxJs</code> introduced breaking changes where <code>of</code> and <code>mapTo</code> are no longer chainable. Would this be the correct way to refactor?</p>
  <pre class="lang-js prettyprint-override"><code>  return of(tag)
      .filter(() =&gt; isAllowedToAdd)
      .pipe(mapTo(tag));
  </code></pre>