title: How to reuse code and make it more flexible?
body: <p>I have the follwing code:</p>
  <pre><code>combineLatest(...this.filtersList.map((f) =&gt; f.filtersChanges)).subscribe(
              (selectedFilters: Filter[]) =&gt; {
                  const filterUrlCombiner = new FilterUrlCombiner();
                  const filterUrlBuilders = selectedFilters
                      .filter(Boolean)
                      .map((filter) =&gt; new FilterUrlBuilder(filter, ComparingOperation.eq));
                  const filterUrls = filterUrlBuilders.map((filter) =&gt; filter.buildStringUrl()).filter(Boolean);
  
                  this.filterBy = filterUrlCombiner.combineUrl(filterUrls);
                  this.settingsService.setExecutionFiltersSettings(selectedFilters);
              },
              (error) =&gt; {
                  console.log('ERROR: ' + error);
              },
          );
  </code></pre>
  <p>This code listens changes from filters <code>filtersChanges</code> and returns them latest values as array.</p>
  <p>Then array is handled by <code>FilterUrlCombiner</code> and <code>FilterUrlBuilder</code> as finish result I get string URL in <code>this.filterBy</code> with all parameters from array.</p>
  <p>I need to reuse the code wrapped in <code>subscribe()</code> in another place, but I dont want copy/past.
  How to reuse code and make it more flexible?</p>