aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/javascript/reference/operators/pipeline_operator
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/ja/web/javascript/reference/operators/pipeline_operator
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/ja/web/javascript/reference/operators/pipeline_operator')
-rw-r--r--files/ja/web/javascript/reference/operators/pipeline_operator/index.html87
1 files changed, 87 insertions, 0 deletions
diff --git a/files/ja/web/javascript/reference/operators/pipeline_operator/index.html b/files/ja/web/javascript/reference/operators/pipeline_operator/index.html
new file mode 100644
index 0000000000..02cbc7d0ba
--- /dev/null
+++ b/files/ja/web/javascript/reference/operators/pipeline_operator/index.html
@@ -0,0 +1,87 @@
+---
+title: パイプライン演算子 (|>)
+slug: Web/JavaScript/Reference/Operators/Pipeline_operator
+tags:
+ - Chaining
+ - Experimental
+ - JavaScript
+ - Language feature
+ - Operator
+ - Pipeline
+ - パイプライン
+ - 実験的
+ - 演算子
+ - 言語機能
+ - 連結
+translation_of: Web/JavaScript/Reference/Operators/Pipeline_operator
+---
+<div>{{jsSidebar("Operators")}}</div>
+
+<p>実験的なパイプライン演算子 <code>|&gt;</code> (現在はステージ 1 です) は、式の値を関数に接続します。これによって、読みやすい方法で一連の関数呼び出しを作成することができます。結果的に、単一の引数を用いた関数呼び出しの糖衣構文となり、次のように書くことができます。</p>
+
+<pre class="brush: js notranslate">let url = "%21" |&gt; decodeURI;</pre>
+
+<p>これと等価な従来の構文は次のようになります。</p>
+
+<pre class="brush: js notranslate">let url = decodeURI("%21");
+</pre>
+
+<h2 id="Syntax" name="Syntax">構文</h2>
+
+<pre class="syntaxbox notranslate"><var>expression</var> |&gt; <var>function</var>
+</pre>
+
+<p>指定された <code><var>expression</var></code> の値が <code><var>function</var></code> に、単一の引数として渡されます。</p>
+
+<h3 id="Parameters" name="Parameters">引数</h3>
+
+<dl>
+ <dt><code><var>expression</var></code></dt>
+ <dd>任意の式です。</dd>
+ <dt><code><var>function</var></code></dt>
+ <dd>任意の関数です。</dd>
+</dl>
+
+<h2 id="Examples" name="Examples">例</h2>
+
+<h3 id="Chaining_function_calls" name="Chaining_function_calls">関数呼び出しの連結</h3>
+
+<p>パイプライン演算子は、複数の関数の連結を読みやすくすることができます。</p>
+
+<pre class="brush: js notranslate">const double = (n) =&gt; n * 2;
+const increment = (n) =&gt; n + 1;
+
+// パイプライン演算子なし
+double(increment(double(double(5)))); // 42
+
+// パイプライン演算子あり
+5 |&gt; double |&gt; double |&gt; increment |&gt; double; // 42
+</pre>
+
+<h2 id="Specifications" name="Specifications">仕様</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">仕様書</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('Pipeline operator', '#sec-intro', 'Pipeline operator')}}</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザー実装状況</h2>
+
+
+
+<p>{{Compat("javascript.operators.pipeline")}}</p>
+
+<h2 id="See_also" name="See_also">関連情報</h2>
+
+<ul>
+ <li><a href="https://github.com/tc39/proposal-pipeline-operator">Github - Proposal-pipeline-operator</a></li>
+ <li><a href="https://github.com/tc39/proposals">TC39 proposals</a></li>
+</ul>