From 70cac903fc285bc888f7a97fc5cc6f5067e177af Mon Sep 17 00:00:00 2001 From: rouzbeh84 Date: Thu, 20 Apr 2017 10:14:29 -0700 Subject: [PATCH 01/11] Update README.md updating function name per #200 thanks to @marzelin to clean up some issues --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3bc8e4be..880714e9 100644 --- a/README.md +++ b/README.md @@ -272,13 +272,13 @@ function emailClients(clients) { **Good:** ```javascript -function emailClients(clients) { +function emailActiveClients(clients) { clients - .filter(isClientActive) + .filter(isActive) .forEach(email); } -function isClientActive(client) { +function isActive(client) { const clientRecord = database.lookup(client); return clientRecord.isActive(); } From a642f5d39b120b3581b8d9927771c56aeaa67595 Mon Sep 17 00:00:00 2001 From: rouzbeh84 Date: Tue, 25 Apr 2017 09:33:18 -0700 Subject: [PATCH 02/11] modify function name for `isActiveClient` --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 880714e9..1097632b 100644 --- a/README.md +++ b/README.md @@ -278,7 +278,7 @@ function emailActiveClients(clients) { .forEach(email); } -function isActive(client) { +function isActiveClient(client) { const clientRecord = database.lookup(client); return clientRecord.isActive(); } From 8dea7985856e578ad727a158d88c477f4f1a010b Mon Sep 17 00:00:00 2001 From: rouzbeh84 Date: Fri, 28 Apr 2017 11:15:19 -0700 Subject: [PATCH 03/11] Update README.md updating L278 to `isActiveClient` --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1097632b..789164a2 100644 --- a/README.md +++ b/README.md @@ -274,7 +274,7 @@ function emailClients(clients) { ```javascript function emailActiveClients(clients) { clients - .filter(isActive) + .filter(isActiveClient) .forEach(email); } From c6ceac2e16ab22bcc025bda25f6821c13991889a Mon Sep 17 00:00:00 2001 From: Elliot Himmelfarb Date: Tue, 2 May 2017 13:36:08 -0600 Subject: [PATCH 04/11] fixed a grammatical typo ...you will find that those *case*... -> ..you will find that those *cases*... --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 789164a2..1a517685 100644 --- a/README.md +++ b/README.md @@ -600,7 +600,7 @@ holding onto a reference of the shopping cart will be affected by any changes. Two caveats to mention to this approach: 1. There might be cases where you actually want to modify the input object, -but when you adopt this programming practice you will find that those case +but when you adopt this programming practice you will find that those cases are pretty rare. Most things can be refactored to have no side effects! 2. Cloning big objects can be very expensive in terms of performance. Luckily, From e2091e97ebddc43968a28f9ca5bc196852b2dca2 Mon Sep 17 00:00:00 2001 From: "Schramm, Moritz" Date: Sat, 6 May 2017 11:58:18 +0200 Subject: [PATCH 05/11] Fix code example for duplicate code --- README.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 1a517685..4c2bd9e7 100644 --- a/README.md +++ b/README.md @@ -440,11 +440,15 @@ function showEmployeeList(employees) { const expectedSalary = employee.calculateExpectedSalary(); const experience = employee.getExperience(); - let portfolio = employee.getGithubLink(); - - if (employee.type === 'manager') { - portfolio = employee.getMBAProjects(); - } + let portfolio; + switch (employee.type) { + case 'manager': + portfolio = employee.getMBAProjects(); + break; + case 'developer': + portfolio = employee.getGithubLink(); + break; + } const data = { expectedSalary, From 28e8e3d7919a030cc9e419a40be85c699f45a3a3 Mon Sep 17 00:00:00 2001 From: Moritz Schramm Date: Sat, 6 May 2017 12:58:12 +0200 Subject: [PATCH 06/11] Fix indentation --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 4c2bd9e7..f3cfc9ad 100644 --- a/README.md +++ b/README.md @@ -440,15 +440,15 @@ function showEmployeeList(employees) { const expectedSalary = employee.calculateExpectedSalary(); const experience = employee.getExperience(); - let portfolio; - switch (employee.type) { - case 'manager': - portfolio = employee.getMBAProjects(); - break; - case 'developer': - portfolio = employee.getGithubLink(); - break; - } + let portfolio; + switch (employee.type) { + case 'manager': + portfolio = employee.getMBAProjects(); + break; + case 'developer': + portfolio = employee.getGithubLink(); + break; + } const data = { expectedSalary, From a5a2f35a44b29a6e6a59b97378c1fc46d46eacc6 Mon Sep 17 00:00:00 2001 From: Moritz Schramm Date: Sat, 6 May 2017 13:01:08 +0200 Subject: [PATCH 07/11] Change indentation to spaces --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index f3cfc9ad..42b9156a 100644 --- a/README.md +++ b/README.md @@ -440,15 +440,15 @@ function showEmployeeList(employees) { const expectedSalary = employee.calculateExpectedSalary(); const experience = employee.getExperience(); - let portfolio; - switch (employee.type) { - case 'manager': - portfolio = employee.getMBAProjects(); - break; - case 'developer': - portfolio = employee.getGithubLink(); - break; - } + let portfolio; + switch (employee.type) { + case 'manager': + portfolio = employee.getMBAProjects(); + break; + case 'developer': + portfolio = employee.getGithubLink(); + break; + } const data = { expectedSalary, From 6b84304b394de96f5974a6badd27cec0f162414d Mon Sep 17 00:00:00 2001 From: Greg Dev Date: Tue, 16 May 2017 00:11:25 +0200 Subject: [PATCH 08/11] Add Polish translation --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 42b9156a..05cb0b83 100644 --- a/README.md +++ b/README.md @@ -2174,6 +2174,7 @@ This is also available in other languages: - [beginor/clean-code-javascript](https://github.com/beginor/clean-code-javascript) - ![de](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Germany.png) **German**: [marcbruederlin/clean-code-javascript](https://github.com/marcbruederlin/clean-code-javascript) - ![kr](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/South-Korea.png) **Korean**: [qkraudghgh/clean-code-javascript-ko](https://github.com/qkraudghgh/clean-code-javascript-ko) + - ![pl](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Poland.png) **Polish**: [greg-dev/clean-code-javascript-pl](https://github.com/greg-dev/clean-code-javascript-pl) - ![ru](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Russia.png) **Russian**: - [BoryaMogila/clean-code-javascript-ru/](https://github.com/BoryaMogila/clean-code-javascript-ru/) - [maksugr/clean-code-javascript](https://github.com/maksugr/clean-code-javascript) From 35a819e282108aaea5e1d20860bf4a7141fc10a4 Mon Sep 17 00:00:00 2001 From: "Andi R. Hermawan" Date: Fri, 2 Jun 2017 11:47:17 +0700 Subject: [PATCH 09/11] Just Add an Indonesia Language Link (#219) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * translate kata pengantar / introduction * translate variabel * typo * function 1/2 * 1/2 replace * translate ### 😂 * translate Function section in Bahasa Indonesia is done * 1/2 SOLID translation to Bahasa Indonesia * SOLID translation to Bahasa Indonesia is Done * translating Error Handling to bahasa indonesia is done * well done, translated to Bahasa Indonesia * review 1, check typo * review 2 * just link --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 05cb0b83..e82f8a3d 100644 --- a/README.md +++ b/README.md @@ -2180,5 +2180,7 @@ This is also available in other languages: - [maksugr/clean-code-javascript](https://github.com/maksugr/clean-code-javascript) - ![vi](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Vietnam.png) **Vietnamese**: [hienvd/clean-code-javascript/](https://github.com/hienvd/clean-code-javascript/) - ![ja](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Japan.png) **Japanese**: [mitsuruog/clean-code-javascript/](https://github.com/mitsuruog/clean-code-javascript/) + - ![id](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Indonesia.png) **Indonesia**: + [andirkh/clean-code-javascript/](https://github.com/andirkh/clean-code-javascript/) **[⬆ back to top](#table-of-contents)** From ab1582512a552ca9efb72fbcea0002b414ae386c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Grzegorz=20Zaj=C4=85c?= Date: Fri, 2 Jun 2017 18:32:07 +0200 Subject: [PATCH 10/11] Update README.md Capital letters in const, remove default data in class Car --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e82f8a3d..1c899561 100644 --- a/README.md +++ b/README.md @@ -1148,9 +1148,9 @@ car.save(); ```javascript class Car { constructor() { - this.make = 'Honda'; - this.model = 'Accord'; - this.color = 'white'; + this.make = ''; + this.model = ''; + this.color = ''; } setMake(make) { @@ -1945,8 +1945,8 @@ class Alpaca {} const DAYS_IN_WEEK = 7; const DAYS_IN_MONTH = 30; -const songs = ['Back In Black', 'Stairway to Heaven', 'Hey Jude']; -const artists = ['ACDC', 'Led Zeppelin', 'The Beatles']; +const SONGS = ['Back In Black', 'Stairway to Heaven', 'Hey Jude']; +const ARTISTS = ['ACDC', 'Led Zeppelin', 'The Beatles']; function eraseDatabase() {} function restoreDatabase() {} From f9ae29a521615158926ab6465ab4891b10b49e0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Grzegorz=20Zaj=C4=85c?= Date: Wed, 7 Jun 2017 20:31:27 +0200 Subject: [PATCH 11/11] Pass make, model and color in constructor --- README.md | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 1c899561..bbca759c 100644 --- a/README.md +++ b/README.md @@ -1114,10 +1114,10 @@ and you can chain further class methods onto it. **Bad:** ```javascript class Car { - constructor() { - this.make = 'Honda'; - this.model = 'Accord'; - this.color = 'white'; + constructor(make, model, color) { + this.make = make; + this.model = model; + this.color = color; } setMake(make) { @@ -1137,20 +1137,18 @@ class Car { } } -const car = new Car(); +const car = new Car('Ford','F-150','red'); car.setColor('pink'); -car.setMake('Ford'); -car.setModel('F-150'); car.save(); ``` **Good:** ```javascript class Car { - constructor() { - this.make = ''; - this.model = ''; - this.color = ''; + constructor(make, model, color) { + this.make = make; + this.model = model; + this.color = color; } setMake(make) { @@ -1178,10 +1176,8 @@ class Car { } } -const car = new Car() +const car = new Car('Ford','F-150','red') .setColor('pink') - .setMake('Ford') - .setModel('F-150') .save(); ``` **[⬆ back to top](#table-of-contents)**