Babel
  • Docs
  • Setup
  • Try it out
  • Videos
  • Blog
  • Donate
  • Team
  • GitHub

›TC39 Proposals

Extensions

  • React Plugin
  • Flow Plugin
  • Typescript Plugin

Modules

  • AMD
  • Common JS
  • SystemJS
  • UMD

TC39 Proposals

  • async-do-expressions
  • decorators
  • do-expressions
  • export-default-from
  • function-bind
  • function-sent
  • partial-application
  • pipeline-operator
  • private-methods
  • record-and-tuple
  • throw-expressions

@babel/preset-env

    ES2022

    • class-properties
    • class-static-block
    • private-property-in-object
    • syntax-top-level-await

    ES2021

    • logical-assignment-operators
    • numeric-separator

    ES2020

    • export-namespace-from
    • nullish-coalescing-operator
    • optional-chaining
    • syntax-bigint
    • syntax-dynamic-import
    • syntax-import-meta

    ES2019

    • optional-catch-binding
    • json-strings

    ES2018

    • async-generator-functions
    • object-rest-spread
    • unicode-property-regex
    • dotall-regex
    • named-capturing-groups-regex

    ES2017

    • async-to-generator

    ES2016

    • exponentiation-operator

    ES2015

    • arrow-functions
    • block-scoping
    • classes
    • computed-properties
    • destructuring
    • duplicate-keys
    • for-of
    • function-name
    • instanceof
    • literals
    • new-target
    • object-super
    • parameters
    • shorthand-properties
    • spread
    • sticky-regex
    • template-literals
    • typeof-symbol
    • unicode-escapes
    • unicode-regex

    ES5

    • property-mutators

    ES3

    • member-expression-literals
    • property-literals
    • reserved-words
Edit

@babel/plugin-proposal-pipeline-operator

Installation

$ npm install --save-dev @babel/plugin-proposal-pipeline-operator

Usage

The pipeline operator has several competing proposals. Configure which proposal to use with the required "proposal" option.

ValueProposalVersion added
"minimal"Minimal F#-style pipesv7.0.0
"fsharp"F#-style pipes with awaitv7.5.0
"hack"Hack-style pipesv7.15.0
"smart"Smart-mix pipes (deprecated)v7.3.0

If "proposal": "hack" is used, then a "topicToken": "%" or "topicToken": "#" option must also be included.

The "proposal": "smart" option is deprecated and subject to removal in a future major version.

When TC39 accepts one of the proposals, that proposal will become the default and the "proposal" option will no longer be required.

Summary of proposals’ behavior

Original expression

Minimal F# pipes
{proposal: "minimal"}

F# pipes with await
{proposal: "fsharp"}

Hack pipes
{proposal: "hack",
topicToken: "%"}

o.m(x)

x |> o.m

x |> o.m

x |> o.m(%)

o.m(0, x)

x |> y=>o.m(0, y)

x |> y=>o.m(0, y)

x |> o.m(0, %)

new o.m(x)

x |> y=>new o.m(y)

x |> y=>new o.m(y)

x |> new o.m(%)

o[x]

x |> y=>o[x]

x |> y=>o[y]

x |> o[%]

x[i]

x |> y=>x[i]

x |> y=>y[i]

x |> %[i]

x + 1

x |> y=>y + 1

x |> y=>y + 1

x |> % + 1

[0, x]

x |> y=>[0, y]

x |> y=>[0, y]

x |> [0, %]

{ key: x }

x |> y=>({ key: y })

x |> y=>({ key: y })

x |> { key: % }

await o.m(x)

Not supported

x |> o.m |> await

x |> await o.m(%)

yield o.m(x)

Not supported Not supported

x |> (yield o.m(%))

With a configuration file (Recommended)

For minimal F# pipes:

{
  "plugins": [
    ["@babel/plugin-proposal-pipeline-operator", { "proposal": "minimal" }]
  ]
}

For F# pipes with await:

{
  "plugins": [
    ["@babel/plugin-proposal-pipeline-operator", { "proposal": "fsharp" }]
  ]
}

For Hack pipes with % topic token:

{
  "plugins": [
    ["@babel/plugin-proposal-pipeline-operator", { "proposal": "hack", "topicToken": "%" }]
  ]
}

For Hack pipes with # topic token:

{
  "plugins": [
    ["@babel/plugin-proposal-pipeline-operator", { "proposal": "hack", "topicToken": "#" }]
  ]
}

Via CLI

Because this plugin requires a configuration option, it cannot be directly configured from the CLI. Use a config file instead with the CLI, to add and configure this plugin.

Via Node API

For minimal F# pipes
{proposal: "minimal"}:

require("@babel/core").transformSync("code", {
  plugins: [
    [ "@babel/plugin-proposal-pipeline-operator", { proposal: "minimal" } ],
  ],
});

For F# pipes with await:

require("@babel/core").transformSync("code", {
  plugins: [
    [ "@babel/plugin-proposal-pipeline-operator", { proposal: "fsharp" } ],
  ],
});

For Hack pipes with % topic token:

require("@babel/core").transformSync("code", {
  plugins: [
    [ "@babel/plugin-proposal-pipeline-operator", { proposal: "hack", topicToken: "%" } ],
  ],
});

For Hack pipes with # topic token:

require("@babel/core").transformSync("code", {
  plugins: [
    [ "@babel/plugin-proposal-pipeline-operator", { proposal: "hack", topicToken: "#" } ],
  ],
});
← partial-applicationprivate-methods →
  • Installation
  • Usage
    • Summary of proposals’ behavior
    • With a configuration file (Recommended)
    • Via CLI
    • Via Node API
Babel
Docs
Learn ES2015
Community
VideosUser ShowcaseStack OverflowSlack ChannelTwitter
More
BlogGitHub OrgGitHub RepoWebsite RepoOld 6.x SiteOld 5.x Site