Skip to content

Commit 69e3437

Browse files
ernestodebestoljharb
authored andcommitted
Examples more consistent with the guidline
comparison operator <= shows better the confusion when using arrow function, than just operator <
1 parent 6ece1f5 commit 69e3437

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,18 +1052,18 @@ Other Style Guides
10521052
10531053
```javascript
10541054
// bad
1055-
const itemHeight = item => item.height > 256 ? item.largeSize : item.smallSize;
1055+
const itemHeight = item => item.height <= 256 ? item.largeSize : item.smallSize;
10561056

10571057
// bad
1058-
const itemHeight = (item) => item.height > 256 ? item.largeSize : item.smallSize;
1058+
const itemHeight = (item) => item.height >= 256 ? item.largeSize : item.smallSize;
10591059

10601060
// good
1061-
const itemHeight = item => (item.height > 256 ? item.largeSize : item.smallSize);
1061+
const itemHeight = item => (item.height <= 256 ? item.largeSize : item.smallSize);
10621062

10631063
// good
10641064
const itemHeight = (item) => {
10651065
const { height, largeSize, smallSize } = item;
1066-
return height > 256 ? largeSize : smallSize;
1066+
return height <= 256 ? largeSize : smallSize;
10671067
};
10681068
```
10691069

0 commit comments

Comments
 (0)