it&#x27;s very common in javascript to have chained methods, to be able to do things like<p><pre><code>    _(array)
    .compact()
    .map(function(x) {
       return x * x;
    })
    .filter(function(x) {
        return x &gt; 100;
    }).value()
</code></pre>
(example from underscore&#x2F;lodash)<p>The problem with this is to be able to add a custom function to this pipeline, you have to extend the prototype of the library with your own functions, or re-implement it.<p>Extending the prototype is considered bad practice for a lot of reasons, for example due to polluting code in other modules or upstream changes breaking your code.<p>If instead of chaining methods we chained functions we are left with this awkward syntax:<p><pre><code>    custom(filter(map(compact(array), function(x) {
         return x * x;
    }), function(x) {
         return x &gt; 100;
    }));
</code></pre>
it&#x27;s much cleaner to write it like this:<p><pre><code>    compact(arr)
    |&gt; map(function(x) {
        return x * x;
    })
    |&gt; filter(function(x) {
        return x &gt; 100;
    })
    |&gt; custom
</code></pre>
The linked page has a nice example and explanation about this concerning promises <a href="https:&#x2F;&#x2F;github.com&#x2F;mindeavor&#x2F;es-pipeline-operator#sample-usage-with-promises" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mindeavor&#x2F;es-pipeline-operator#sample-usa...</a>