Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b79e951

Browse files
hshoffljharb
authored andcommitted
[eslint-v2][arrays] update array-callback-return good/bad ex
1 parent 822c0df commit b79e951

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -374,22 +374,25 @@ Other Style Guides
374374
});
375375

376376
// bad
377-
[1, 2, 3].filter((x) => {
378-
if (x > 2) {
379-
return true;
377+
inbox].filter((msg) => {
378+
const { subject, author } = msg;
379+
if (subject === 'Mockingbird') {
380+
return author === 'Harper Lee';
380381
} else {
381382
return false;
382383
}
383384
});
384385

385386
// good
386387
[1, 2, 3].filter((x) => {
387-
if (x > 2) {
388-
return true;
389-
}
388+
inbox].filter((msg) => {
389+
const { subject, author } = msg;
390+
if (subject === 'Mockingbird') {
391+
return author === 'Harper Lee';
392+
}
390393

391-
return false;
392-
});
394+
return false;
395+
});
393396
```
394397
395398
**[⬆ back to top](#table-of-contents)**

0 commit comments

Comments
 (0)