Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@babel/plugin-proposal-pipeline-operator
Advanced tools
Transform pipeline operator into call expressions
@babel/plugin-proposal-pipeline-operator is a Babel plugin that allows you to use the pipeline operator (|>) in your JavaScript code. The pipeline operator is a proposed feature for JavaScript that enables a more readable and functional approach to chaining functions.
Basic Pipeline Usage
This feature allows you to chain functions in a readable manner. The value 5 is first passed to the `double` function, and then the result is passed to the `increment` function.
const result = 5 |> double |> increment;
function double(x) { return x * 2; }
function increment(x) { return x + 1; }
Using with Arrow Functions
You can also use arrow functions within the pipeline. This example doubles the value 5 and then increments it by 1.
const result = 5 |> (x => x * 2) |> (x => x + 1);
Complex Pipelines
This feature demonstrates a more complex pipeline where a string is transformed through multiple stages: converting to uppercase, appending another string, and then splitting into an array.
const result = 'hello' |> (s => s.toUpperCase()) |> (s => `${s} world`) |> (s => s.split(' '));
Lodash is a utility library that provides a wide range of functions for common programming tasks. While it does not support the pipeline operator, it offers a `_.flow` function that allows for function composition in a similar manner.
Ramda is a functional programming library for JavaScript that emphasizes immutability and side-effect-free functions. It provides a `R.pipe` function that allows for function composition, similar to the pipeline operator.
RxJS is a library for reactive programming using Observables. It allows you to compose asynchronous and event-based programs using observable sequences and provides operators that can be chained in a manner similar to the pipeline operator.
Transform pipeline operator into call expressions
See our website @babel/plugin-proposal-pipeline-operator for more information.
Using npm:
npm install --save-dev @babel/plugin-proposal-pipeline-operator
or using yarn:
yarn add @babel/plugin-proposal-pipeline-operator --dev
FAQs
Transform pipeline operator into call expressions
We found that @babel/plugin-proposal-pipeline-operator demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.