Skip to content

Commit a1236bb

Browse files
authored
Merge pull request tc39#34 from bfred-it/patch-1
Clarify variable names and separation in examples
2 parents 1a5ed7e + f505b40 commit a1236bb

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ Stage 0 Proposal<br>
33
Champions: Brian Terlson (Microsoft, [@bterlson](https://twitter.com/bterlson)), Sebastian Markbåge (Facebook, [@sebmarkbage](https://twitter.com/sebmarkbage))
44

55
```js
6-
let length = vector => match (vector) {
6+
let getLength = vector => match (vector) {
77
{ 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,
1010
else: {
1111
throw new Error("Unknown vector type");
1212
}
@@ -140,7 +140,7 @@ let node = {
140140
name: 'If',
141141
alternate: { name: 'Statement', value: ... },
142142
consequent: { name: 'Statement', value: ... }
143-
}
143+
};
144144

145145
match (node) {
146146
{ 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
187187
```js
188188
let obj = {
189189
get x() { /* calculate many things */ }
190-
}
190+
};
191+
191192
match (obj.x) {
192193
//...
193194
else: obj.x // recalculates.
@@ -206,7 +207,7 @@ Array patterns could be extended to take a value allowing for matching propertie
206207

207208
```js
208209
// points can't have an x or y greater than 100
209-
let outOfBoundsPoint = p => match (p) {
210+
let isPointOutOfBounds = p => match (p) {
210211
{ x > 100, y }: true,
211212
{ x, y > 100 }: true,
212213
else: false

0 commit comments

Comments
 (0)