Skip to content

Commit

Permalink
Merge pull request ryanmcdermott#81 from vsemozhetbyt/arrow-parens
Browse files Browse the repository at this point in the history
parenthesize arrow function arguments consistently
  • Loading branch information
ryanmcdermott authored Jan 11, 2017
2 parents 99bee74 + 594dd62 commit 0c4fa28
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ this guide other than this, you'll be ahead of many developers.
**Bad:**
```javascript
function emailClients(clients) {
clients.forEach(client => {
clients.forEach((client) => {
const clientRecord = database.lookup(client);
if (clientRecord.isActive()) {
email(client);
Expand Down Expand Up @@ -376,7 +376,7 @@ code eligible for refactoring.
**Bad:**
```javascript
function showDeveloperList(developers) {
developers.forEach(developer => {
developers.forEach((developer) => {
const expectedSalary = developer.calculateExpectedSalary();
const experience = developer.getExperience();
const githubLink = developer.getGithubLink();
Expand All @@ -391,7 +391,7 @@ function showDeveloperList(developers) {
}
function showManagerList(managers) {
managers.forEach(manager => {
managers.forEach((manager) => {
const expectedSalary = manager.calculateExpectedSalary();
const experience = manager.getExperience();
const portfolio = manager.getMBAProjects();
Expand All @@ -409,7 +409,7 @@ function showManagerList(managers) {
**Good**:
```javascript
function showList(employees) {
employees.forEach(employee => {
employees.forEach((employee) => {
const expectedSalary = employee.calculateExpectedSalary();
const experience = employee.getExperience();
Expand Down Expand Up @@ -1828,21 +1828,21 @@ from `try/catch`.
**Bad:**
```javascript
getdata()
.then(data => {
.then((data) => {
functionThatMightThrow(data);
})
.catch(error => {
.catch((error) => {
console.log(error);
});
```
**Good:**
```javascript
getdata()
.then(data => {
.then((data) => {
functionThatMightThrow(data);
})
.catch(error => {
.catch((error) => {
// One option (more noisy than console.log):
console.error(error);
// Another option:
Expand Down

0 comments on commit 0c4fa28

Please sign in to comment.