From c7b5077af4755e236dbb1931c2b5066932867b3f Mon Sep 17 00:00:00 2001 From: cntanglijun <869058216@qq.com> Date: Sun, 25 Feb 2018 00:48:27 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=B0=91=E4=BA=86=E4=B8=80=E4=B8=AA"?= =?UTF-8?q?=E4=B8=AA"=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/generator-async.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/generator-async.md b/docs/generator-async.md index fd52009..53966a3 100644 --- a/docs/generator-async.md +++ b/docs/generator-async.md @@ -151,7 +151,7 @@ g.next() // { value: 3, done: false } g.next(2) // { value: 2, done: true } ``` -上面代码中,第一`next`方法的`value`属性,返回表达式`x + 2`的值`3`。第二个`next`方法带有参数`2`,这个参数可以传入 Generator 函数,作为上个阶段异步任务的返回结果,被函数体内的变量`y`接收。因此,这一步的`value`属性,返回的就是`2`(变量`y`的值)。 +上面代码中,第一个`next`方法的`value`属性,返回表达式`x + 2`的值`3`。第二个`next`方法带有参数`2`,这个参数可以传入 Generator 函数,作为上个阶段异步任务的返回结果,被函数体内的变量`y`接收。因此,这一步的`value`属性,返回的就是`2`(变量`y`的值)。 Generator 函数内部还可以部署错误处理代码,捕获函数体外抛出的错误。 From df6cc1a71de2b2c11d389709ba9bc38bdce30159 Mon Sep 17 00:00:00 2001 From: yuri Date: Sun, 25 Feb 2018 14:16:22 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E7=AE=A1=E9=81=93?= =?UTF-8?q?=E8=BF=90=E7=AE=97=E7=AC=A6=E6=8F=90=E6=A1=88=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/proposals.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/proposals.md b/docs/proposals.md index 9ca613f..f28f9e6 100644 --- a/docs/proposals.md +++ b/docs/proposals.md @@ -319,7 +319,7 @@ g(1, 2, 3); // [1, 2, 3, 9, 1, 2, 3] ## 管道运算符 -Unix 操作系统有一个管道机制(pipeline),可以把前一个操作的值传给后一个操作。这个机制非常有用,使得简单的操作可以组合成为复杂的操作。许多语言都有管道的实现,现在有一个[提案](https://github.com/tc39/proposal-partial-application),让 JavaScript 也拥有管道机制。 +Unix 操作系统有一个管道机制(pipeline),可以把前一个操作的值传给后一个操作。这个机制非常有用,使得简单的操作可以组合成为复杂的操作。许多语言都有管道的实现,现在有一个[提案](https://github.com/tc39/proposal-pipeline-operator),让 JavaScript 也拥有管道机制。 JavaScript 的管道是一个运算符,写作`|>`。它的左边是一个表达式,右边是一个函数。管道运算符把左边表达式的值,传入右边的函数进行求值。 From 78d9b668dda9d7b4d8caf3da724596311f0007a9 Mon Sep 17 00:00:00 2001 From: yuri Date: Sun, 25 Feb 2018 14:24:17 +0800 Subject: [PATCH 3/3] =?UTF-8?q?Null=20=E4=BC=A0=E5=AF=BC=E8=BF=90=E7=AE=97?= =?UTF-8?q?=E7=AC=A6=E6=8F=90=E6=A1=88=E5=9C=B0=E5=9D=80=E6=9B=BF=E6=8D=A2?= =?UTF-8?q?=E4=B8=BAtc39=E5=AE=98=E6=96=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/proposals.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/proposals.md b/docs/proposals.md index 9ca613f..97ad416 100644 --- a/docs/proposals.md +++ b/docs/proposals.md @@ -129,7 +129,7 @@ const firstName = (message && message.body.user.firstName) || 'default'; ``` -这样的层层判断非常麻烦,因此现在有一个[提案](https://github.com/claudepache/es-optional-chaining),引入了“Null 传导运算符”(null propagation operator)`?.`,简化上面的写法。 +这样的层层判断非常麻烦,因此现在有一个[提案](https://github.com/tc39/proposal-optional-chaining),引入了“Null 传导运算符”(null propagation operator)`?.`,简化上面的写法。 ```javascript const firstName = message?.body?.user?.firstName || 'default';