Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 62dfd20

Browse files
esganzerlaryanmcdermott
authored andcommitted
Fix some **Good**: to **Good:** (ryanmcdermott#145)
Fix **Good**: to **Good:**
1 parent 85029c4 commit 62dfd20

File tree

1 file changed

+42
-41
lines changed

1 file changed

+42
-41
lines changed

‎README.md‎

Lines changed: 42 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
# clean-code-javascript
23

34
## Table of Contents
@@ -48,7 +49,7 @@ improvement. Beat up the code instead!
4849
const yyyymmdstr = moment().format('YYYY/MM/DD');
4950
```
5051

51-
**Good**:
52+
**Good:**
5253
```javascript
5354
const currentDate = moment().format('YYYY/MM/DD');
5455
```
@@ -63,7 +64,7 @@ getClientData();
6364
getCustomerRecord();
6465
```
6566

66-
**Good**:
67+
**Good:**
6768
```javascript
6869
getUser();
6970
```
@@ -85,7 +86,7 @@ setTimeout(blastOff, 86400000);
8586

8687
```
8788

88-
**Good**:
89+
**Good:**
8990
```javascript
9091
// Declare them as capitalized `const` globals.
9192
const MILLISECONDS_IN_A_DAY = 86400000;
@@ -103,7 +104,7 @@ const cityZipCodeRegex = /^[^,\\]+[,\\\s]+(.+?)\s*(\d{5})?$/;
103104
saveCityZipCode(address.match(cityZipCodeRegex)[1], address.match(cityZipCodeRegex)[2]);
104105
```
105106

106-
**Good**:
107+
**Good:**
107108
```javascript
108109
const address = 'One Infinite Loop, Cupertino 95014';
109110
const cityZipCodeRegex = /^[^,\\]+[,\\\s]+(.+?)\s*(\d{5})?$/;
@@ -129,7 +130,7 @@ locations.forEach((l) => {
129130
});
130131
```
131132

132-
**Good**:
133+
**Good:**
133134
```javascript
134135
const locations = ['Austin', 'New York', 'San Francisco'];
135136
locations.forEach((location) => {
@@ -160,7 +161,7 @@ function paintCar(car) {
160161
}
161162
```
162163

163-
**Good**:
164+
**Good:**
164165
```javascript
165166
const Car = {
166167
make: 'Honda',
@@ -185,7 +186,7 @@ function createMicrobrewery(name) {
185186

186187
```
187188

188-
**Good**:
189+
**Good:**
189190
```javascript
190191
function createMicrobrewery(breweryName = 'Hipster Brew Co.') {
191192
// ...
@@ -218,7 +219,7 @@ function createMenu(title, body, buttonText, cancellable) {
218219
}
219220
```
220221

221-
**Good**:
222+
**Good:**
222223
```javascript
223224
function createMenu(config) {
224225
// ...
@@ -253,7 +254,7 @@ function emailClients(clients) {
253254
}
254255
```
255256

256-
**Good**:
257+
**Good:**
257258
```javascript
258259
function emailClients(clients) {
259260
clients
@@ -282,7 +283,7 @@ const date = new Date();
282283
addToDate(date, 1);
283284
```
284285

285-
**Good**:
286+
**Good:**
286287
```javascript
287288
function addMonthToDate(month, date) {
288289
// ...
@@ -324,7 +325,7 @@ function parseBetterJSAlternative(code) {
324325
}
325326
```
326327

327-
**Good**:
328+
**Good:**
328329
```javascript
329330
function tokenize(code) {
330331
const REGEXES = [
@@ -416,7 +417,7 @@ function showManagerList(managers) {
416417
}
417418
```
418419

419-
**Good**:
420+
**Good:**
420421
```javascript
421422
function showList(employees) {
422423
employees.forEach((employee) => {
@@ -462,7 +463,7 @@ function createMenu(config) {
462463
createMenu(menuConfig);
463464
```
464465

465-
**Good**:
466+
**Good:**
466467
```javascript
467468
const menuConfig = {
468469
title: 'Order',
@@ -502,7 +503,7 @@ function createFile(name, temp) {
502503
}
503504
```
504505

505-
**Good**:
506+
**Good:**
506507
```javascript
507508
function createFile(name) {
508509
fs.create(name);
@@ -545,7 +546,7 @@ splitIntoFirstAndLastName();
545546
console.log(name); // ['Ryan', 'McDermott'];
546547
```
547548

548-
**Good**:
549+
**Good:**
549550
```javascript
550551
function splitIntoFirstAndLastName(name) {
551552
return name.split(' ');
@@ -668,7 +669,7 @@ for (let i = 0; i < programmerOutput.length; i++) {
668669
}
669670
```
670671

671-
**Good**:
672+
**Good:**
672673
```javascript
673674
const programmerOutput = [
674675
{
@@ -701,7 +702,7 @@ if (fsm.state === 'fetching' && isEmpty(listNode)) {
701702
}
702703
```
703704

704-
**Good**:
705+
**Good:**
705706
```javascript
706707
function shouldShowSpinner(fsm, listNode) {
707708
return fsm.state === 'fetching' && isEmpty(listNode);
@@ -726,7 +727,7 @@ if (!isDOMNodeNotPresent(node)) {
726727
}
727728
```
728729

729-
**Good**:
730+
**Good:**
730731
```javascript
731732
function isDOMNodePresent(node) {
732733
// ...
@@ -765,7 +766,7 @@ class Airplane {
765766
}
766767
```
767768

768-
**Good**:
769+
**Good:**
769770
```javascript
770771
class Airplane {
771772
// ...
@@ -811,7 +812,7 @@ function travelToTexas(vehicle) {
811812
}
812813
```
813814

814-
**Good**:
815+
**Good:**
815816
```javascript
816817
function travelToTexas(vehicle) {
817818
vehicle.move(this.currentLocation, new Location('texas'));
@@ -842,7 +843,7 @@ function combine(val1, val2) {
842843
}
843844
```
844845

845-
**Good**:
846+
**Good:**
846847
```javascript
847848
function combine(val1, val2) {
848849
return val1 + val2;
@@ -867,7 +868,7 @@ for (let i = 0, len = list.length; i < len; i++) {
867868
}
868869
```
869870

870-
**Good**:
871+
**Good:**
871872
```javascript
872873
for (let i = 0; i < list.length; i++) {
873874
// ...
@@ -895,7 +896,7 @@ inventoryTracker('apples', req, 'www.inventory-awesome.io');
895896

896897
```
897898

898-
**Good**:
899+
**Good:**
899900
```javascript
900901
function newRequestModule(url) {
901902
// ...
@@ -938,7 +939,7 @@ const bankAccount = new BankAccount();
938939
bankAccount.balance -= 100;
939940
```
940941

941-
**Good**:
942+
**Good:**
942943
```javascript
943944
class BankAccount {
944945
constructor(balance = 1000) {
@@ -993,7 +994,7 @@ delete employee.name;
993994
console.log(`Employee name: ${employee.getName()}`); // Employee name: undefined
994995
```
995996

996-
**Good**:
997+
**Good:**
997998
```javascript
998999
const Employee = function (name) {
9991000
this.getName = function getName() {
@@ -1039,7 +1040,7 @@ class UserSettings {
10391040
}
10401041
```
10411042

1042-
**Good**:
1043+
**Good:**
10431044
```javascript
10441045
class UserAuth {
10451046
constructor(user) {
@@ -1116,7 +1117,7 @@ function makeHttpCall(url) {
11161117
}
11171118
```
11181119

1119-
**Good**:
1120+
**Good:**
11201121
```javascript
11211122
class AjaxAdapter extends Adapter {
11221123
constructor() {
@@ -1223,7 +1224,7 @@ const rectangles = [new Rectangle(), new Rectangle(), new Square()];
12231224
renderLargeRectangles(rectangles);
12241225
```
12251226

1226-
**Good**:
1227+
**Good:**
12271228
```javascript
12281229
class Shape {
12291230
setColor(color) {
@@ -1331,7 +1332,7 @@ const $ = new DOMTraverser({
13311332

13321333
```
13331334

1334-
**Good**:
1335+
**Good:**
13351336
```javascript
13361337
class DOMTraverser {
13371338
constructor(settings) {
@@ -1418,7 +1419,7 @@ const inventoryTracker = new InventoryTracker(['apples', 'bananas']);
14181419
inventoryTracker.requestItems();
14191420
```
14201421

1421-
**Good**:
1422+
**Good:**
14221423
```javascript
14231424
class InventoryTracker {
14241425
constructor(items, requester) {
@@ -1576,7 +1577,7 @@ car.setModel('F-150');
15761577
car.save();
15771578
```
15781579

1579-
**Good**:
1580+
**Good:**
15801581
```javascript
15811582
class Car {
15821583
constructor() {
@@ -1659,7 +1660,7 @@ class EmployeeTaxData extends Employee {
16591660
}
16601661
```
16611662

1662-
**Good**:
1663+
**Good:**
16631664
```javascript
16641665
class EmployeeTaxData {
16651666
constructor(ssn, salary) {
@@ -1726,7 +1727,7 @@ describe('MakeMomentJSGreatAgain', () => {
17261727
});
17271728
```
17281729

1729-
**Good**:
1730+
**Good:**
17301731
```javascript
17311732
const assert = require('assert');
17321733

@@ -1775,7 +1776,7 @@ require('request').get('https://en.wikipedia.org/wiki/Robert_Cecil_Martin', (req
17751776

17761777
```
17771778

1778-
**Good**:
1779+
**Good:**
17791780
```javascript
17801781
require('request-promise').get('https://en.wikipedia.org/wiki/Robert_Cecil_Martin')
17811782
.then((response) => {
@@ -1813,7 +1814,7 @@ require('request-promise').get('https://en.wikipedia.org/wiki/Robert_Cecil_Marti
18131814

18141815
```
18151816

1816-
**Good**:
1817+
**Good:**
18171818
```javascript
18181819
async function getCleanCodeArticle() {
18191820
try {
@@ -1931,7 +1932,7 @@ class animal {}
19311932
class Alpaca {}
19321933
```
19331934

1934-
**Good**:
1935+
**Good:**
19351936
```javascript
19361937
const DAYS_IN_WEEK = 7;
19371938
const DAYS_IN_MONTH = 30;
@@ -1992,7 +1993,7 @@ const review = new PerformanceReview(user);
19921993
review.perfReview();
19931994
```
19941995

1995-
**Good**:
1996+
**Good:**
19961997
```javascript
19971998
class PerformanceReview {
19981999
constructor(employee) {
@@ -2058,7 +2059,7 @@ function hashIt(data) {
20582059
}
20592060
```
20602061

2061-
**Good**:
2062+
**Good:**
20622063
```javascript
20632064

20642065
function hashIt(data) {
@@ -2088,7 +2089,7 @@ doStuff();
20882089
// doSoMuchStuff();
20892090
```
20902091

2091-
**Good**:
2092+
**Good:**
20922093
```javascript
20932094
doStuff();
20942095
```
@@ -2111,7 +2112,7 @@ function combine(a, b) {
21112112
}
21122113
```
21132114

2114-
**Good**:
2115+
**Good:**
21152116
```javascript
21162117
function combine(a, b) {
21172118
return a + b;
@@ -2141,7 +2142,7 @@ const actions = function() {
21412142
};
21422143
```
21432144

2144-
**Good**:
2145+
**Good:**
21452146
```javascript
21462147
$scope.model = {
21472148
menu: 'foo',

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /