Skip to content

Commit 383dd49

Browse files
Merge pull request ryanmcdermott#64 from HemantPawar/master
Fixed few examples
2 parents e4100a3 + 0b3aba1 commit 383dd49

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

README.md

+25-25
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ const menuConfig = {
228228
body: 'Bar',
229229
buttonText: 'Baz',
230230
cancellable: true
231-
}
231+
};
232232

233233
function createMenu(config) {
234234
// ...
@@ -314,7 +314,7 @@ function parseBetterJSAlternative(code) {
314314
REGEXES.forEach((REGEX) => {
315315
statements.forEach((statement) => {
316316
// ...
317-
})
317+
});
318318
});
319319

320320
const ast = [];
@@ -324,7 +324,7 @@ function parseBetterJSAlternative(code) {
324324

325325
ast.forEach((node) => {
326326
// parse...
327-
})
327+
});
328328
}
329329
```
330330

@@ -340,7 +340,7 @@ function tokenize(code) {
340340
REGEXES.forEach((REGEX) => {
341341
statements.forEach((statement) => {
342342
tokens.push( /* ... */ );
343-
})
343+
});
344344
});
345345

346346
return tokens;
@@ -360,7 +360,7 @@ function parseBetterJSAlternative(code) {
360360
const ast = lexer(tokens);
361361
ast.forEach((node) => {
362362
// parse...
363-
})
363+
});
364364
}
365365
```
366366
**[⬆ back to top](#table-of-contents)**
@@ -441,12 +441,12 @@ const menuConfig = {
441441
body: 'Bar',
442442
buttonText: null,
443443
cancellable: true
444-
}
444+
};
445445

446446
function createMenu(config) {
447-
config.title = config.title || 'Foo'
448-
config.body = config.body || 'Bar'
449-
config.buttonText = config.buttonText || 'Baz'
447+
config.title = config.title || 'Foo';
448+
config.body = config.body || 'Bar';
449+
config.buttonText = config.buttonText || 'Baz';
450450
config.cancellable = config.cancellable === undefined ? config.cancellable : true;
451451

452452
}
@@ -461,7 +461,7 @@ const menuConfig = {
461461
// User did not include 'body' key
462462
buttonText: 'Send',
463463
cancellable: true
464-
}
464+
};
465465

466466
function createMenu(config) {
467467
config = Object.assign({
@@ -543,7 +543,7 @@ function splitIntoFirstAndLastName(name) {
543543
return name.split(' ');
544544
}
545545

546-
const name = 'Ryan McDermott'
546+
const name = 'Ryan McDermott';
547547
const newName = splitIntoFirstAndLastName(name);
548548

549549
console.log(name); // 'Ryan McDermott';
@@ -579,7 +579,7 @@ Array.prototype.diff = function diff(comparisonArray) {
579579
}
580580

581581
return values;
582-
}
582+
};
583583
```
584584

585585
**Good:**
@@ -952,11 +952,11 @@ This can be accomplished through closures (for ES5 and below).
952952

953953
const Employee = function(name) {
954954
this.name = name;
955-
}
955+
};
956956

957957
Employee.prototype.getName = function getName() {
958958
return this.name;
959-
}
959+
};
960960

961961
const employee = new Employee('John Doe');
962962
console.log(`Employee name: ${employee.getName()}`); // Employee name: John Doe
@@ -1026,7 +1026,7 @@ class UserAuth {
10261026
class UserSettings {
10271027
constructor(user) {
10281028
this.user = user;
1029-
this.auth = new UserAuth(user)
1029+
this.auth = new UserAuth(user);
10301030
}
10311031

10321032
changeSettings(settings) {
@@ -1145,7 +1145,7 @@ function renderLargeRectangles(rectangles) {
11451145
rectangle.setHeight(5);
11461146
const area = rectangle.getArea(); // BAD: Will return 25 for Square. Should be 20.
11471147
rectangle.render(area);
1148-
})
1148+
});
11491149
}
11501150

11511151
const rectangles = [new Rectangle(), new Rectangle(), new Square()];
@@ -1214,7 +1214,7 @@ function renderLargeShapes(shapes) {
12141214

12151215
const area = shape.getArea();
12161216
shape.render(area);
1217-
})
1217+
});
12181218
}
12191219

12201220
const shapes = [new Rectangle(), new Rectangle(), new Square()];
@@ -1505,7 +1505,7 @@ class Car {
15051505
const car = new Car();
15061506
car.setColor('pink');
15071507
car.setMake('Ford');
1508-
car.setModel('F-150')
1508+
car.setModel('F-150');
15091509
car.save();
15101510
```
15111511

@@ -1703,9 +1703,9 @@ require('request').get('https://en.wikipedia.org/wiki/Robert_Cecil_Martin', (req
17031703
} else {
17041704
console.log('File written');
17051705
}
1706-
})
1706+
});
17071707
}
1708-
})
1708+
});
17091709

17101710
```
17111711

@@ -1720,7 +1720,7 @@ require('request-promise').get('https://en.wikipedia.org/wiki/Robert_Cecil_Marti
17201720
})
17211721
.catch((err) => {
17221722
console.error(err);
1723-
})
1723+
});
17241724

17251725
```
17261726
**[⬆ back to top](#table-of-contents)**
@@ -1743,15 +1743,15 @@ require('request-promise').get('https://en.wikipedia.org/wiki/Robert_Cecil_Marti
17431743
})
17441744
.catch((err) => {
17451745
console.error(err);
1746-
})
1746+
});
17471747

17481748
```
17491749

17501750
**Good**:
17511751
```javascript
17521752
async function getCleanCodeArticle() {
17531753
try {
1754-
const request = await require('request-promise')
1754+
const request = await require('request-promise');
17551755
const response = await request.get('https://en.wikipedia.org/wiki/Robert_Cecil_Martin');
17561756
const fileHandle = await require('fs-promise');
17571757

@@ -2075,7 +2075,7 @@ $scope.model = {
20752075
////////////////////////////////////////////////////////////////////////////////
20762076
const actions = function() {
20772077
// ...
2078-
}
2078+
};
20792079
```
20802080

20812081
**Good**:
@@ -2087,6 +2087,6 @@ $scope.model = {
20872087

20882088
const actions = function() {
20892089
// ...
2090-
}
2090+
};
20912091
```
20922092
**[⬆ back to top](#table-of-contents)**

0 commit comments

Comments
 (0)