Skip to content

Commit 0c4fa28

Browse files
Merge pull request ryanmcdermott#81 from vsemozhetbyt/arrow-parens
parenthesize arrow function arguments consistently
2 parents 99bee74 + 594dd62 commit 0c4fa28

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ this guide other than this, you'll be ahead of many developers.
247247
**Bad:**
248248
```javascript
249249
function emailClients(clients) {
250-
clients.forEach(client => {
250+
clients.forEach((client) => {
251251
const clientRecord = database.lookup(client);
252252
if (clientRecord.isActive()) {
253253
email(client);
@@ -376,7 +376,7 @@ code eligible for refactoring.
376376
**Bad:**
377377
```javascript
378378
function showDeveloperList(developers) {
379-
developers.forEach(developer => {
379+
developers.forEach((developer) => {
380380
const expectedSalary = developer.calculateExpectedSalary();
381381
const experience = developer.getExperience();
382382
const githubLink = developer.getGithubLink();
@@ -391,7 +391,7 @@ function showDeveloperList(developers) {
391391
}
392392

393393
function showManagerList(managers) {
394-
managers.forEach(manager => {
394+
managers.forEach((manager) => {
395395
const expectedSalary = manager.calculateExpectedSalary();
396396
const experience = manager.getExperience();
397397
const portfolio = manager.getMBAProjects();
@@ -409,7 +409,7 @@ function showManagerList(managers) {
409409
**Good**:
410410
```javascript
411411
function showList(employees) {
412-
employees.forEach(employee => {
412+
employees.forEach((employee) => {
413413
const expectedSalary = employee.calculateExpectedSalary();
414414
const experience = employee.getExperience();
415415

@@ -1828,21 +1828,21 @@ from `try/catch`.
18281828
**Bad:**
18291829
```javascript
18301830
getdata()
1831-
.then(data => {
1831+
.then((data) => {
18321832
functionThatMightThrow(data);
18331833
})
1834-
.catch(error => {
1834+
.catch((error) => {
18351835
console.log(error);
18361836
});
18371837
```
18381838

18391839
**Good:**
18401840
```javascript
18411841
getdata()
1842-
.then(data => {
1842+
.then((data) => {
18431843
functionThatMightThrow(data);
18441844
})
1845-
.catch(error => {
1845+
.catch((error) => {
18461846
// One option (more noisy than console.log):
18471847
console.error(error);
18481848
// Another option:

0 commit comments

Comments
 (0)