[feature-preview] [v2.4.0] Pipeline global method `Object.prototype.$`
somecodingwitch opened this issue · 0 comments
somecodingwitch commented
Summary
Pipeline global method is a extension to the Object
prototype that adds a method with the $
signature, this method executes a pipeline function that is similar to the |>
operator.
Usage
Like the |>
operator, the pipeline global method can be used with any object, like the following snippet:
const addText1 = (n) => n + 'potato';
const addText2 = (n, text) => n + ' chips ';
const addCustomText = (n, text) => n + text;
const string = "Hello ";
string
.$(addText1)
.$(addText2)
.$(addCustomText, 'from world!')
.$(console.log)
With the output:
> "Hello potato chips from world!"
Development
Planned to be released in 2.4.0