这是一个实验中的功能
此功能某些浏览器尚在开发中，请参考浏览器兼容性表格以得到在不同浏览器中适合使用的前缀。由于该功能对应的标准文档可能被重新修订，所以在未来版本的浏览器中该功能的语法和行为可能随之改变。

试验性的管道操作符 `|>` （目前其标准化流程处于 stage 1 阶段）允许以一种易读的方式去对函数链式调用。本质上来说，管道操作符是单参数函数调用的语法糖，它允许你像这样执行一个调用：

    let url = "%21" |> decodeURI;

使用传统语法写的话，等效的代码是这样的：

    let url = decodeURI("%21");

## 语法

    expression |> function

## 例子

### 函数链式调用

当链式调用多个函数时，使用管道操作符可以改善代码的可读性。

    const double = (n) => n * 2;
    const increment = (n) => n + 1;

    // 没有用管道操作符
    double(increment(double(5))); // 22

    // 用上管道操作符之后
    5 |> double |> increment |> double; // 22

## 规范

规范 | 状态 | 备注
--- | --- | ---
Pipeline operator draft | Stage 1 | Not part of the ECMAScript specification yet.

## 浏览器兼容性Edit

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.

Update compatibility data on GitHub

| Desktop | Mobile | Server
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | Safari on iOS | Samsung Internet | Node.js
Pipeline operator (`|>`) Experimental | Chrome No support No | Edge No support No | Firefox Full support 58 Disabled Full support 58 Disabled Disabled From version 58: this feature is behind the `--enable-pipeline-operator` compile flag. | IE No support No | Opera No support No | Safari No support No | WebView Android No support No | Chrome Android No support No | Edge Mobile No support No | Firefox Android Full support 58 Disabled Full support 58 Disabled Disabled From version 58: this feature is behind the `--enable-pipeline-operator` compile flag. | Opera Android No support No | Safari iOS No support No | Samsung Internet Android No support No | nodejs No support No

### Legend

Full support
  Full support
No support
  No support
Experimental. Expect behavior to change in the future.
  Experimental. Expect behavior to change in the future.
User must explicitly enable this feature.
  User must explicitly enable this feature.

## 参见

- GitHub 上的 TC39/proposals