You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+7-6Lines changed: 7 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -3,10 +3,10 @@ Stage 0 Proposal<br>
3
3
Champions: Brian Terlson (Microsoft, [@bterlson](https://twitter.com/bterlson)), Sebastian Markbåge (Facebook, [@sebmarkbage](https://twitter.com/sebmarkbage))
4
4
5
5
```js
6
-
letlength=vector=>match (vector) {
6
+
letgetLength=vector=>match (vector) {
7
7
{ x, y, z }:Math.sqrt(x **2+ y **2+ z **2),
8
-
{ x, y }:Math.sqrt(x **2+ y **2),
9
-
[...]:vector.length,
8
+
{ x, y }:Math.sqrt(x **2+ y **2),
9
+
[...]:vector.length,
10
10
else: {
11
11
thrownewError("Unknown vector type");
12
12
}
@@ -140,7 +140,7 @@ let node = {
140
140
name:'If',
141
141
alternate: { name:'Statement', value:... },
142
142
consequent: { name:'Statement', value:... }
143
-
}
143
+
};
144
144
145
145
match (node) {
146
146
{ name:'If', alternate }:// if with no else
@@ -187,7 +187,8 @@ I've gone with `else` as it aligns with other areas of JavaScript, but you might
187
187
```js
188
188
let obj = {
189
189
getx() { /* calculate many things */ }
190
-
}
190
+
};
191
+
191
192
match (obj.x) {
192
193
//...
193
194
else:obj.x// recalculates.
@@ -206,7 +207,7 @@ Array patterns could be extended to take a value allowing for matching propertie
0 commit comments