Skip to content

Commit 971a91c

Browse files
committed
Updating some things on the README.
1 parent e12492e commit 971a91c

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,15 @@ foreign name should be prefixed for disambiguation, or even both.
4848

4949
### The name should describe the content
5050

51-
- An array of `thing` should be called just `things`.
51+
- An array should have a name that gives clues about its content.
52+
```javascript
53+
// Bad.
54+
const things = ['dog', 'cat', 'mouse'];
55+
56+
// Good.
57+
const animals = ['dog', 'cat', 'mouse'];
58+
```
59+
5260
- An object of `thing` indexed by some `key` should be called `thingByKey`.
5361
```javascript
5462
// Bad.
@@ -89,11 +97,6 @@ foreign name should be prefixed for disambiguation, or even both.
8997
const stopSequenceAsInt = parseInt(stopSequenceAsString);
9098
```
9199

92-
As soon as you start to have different representations of the same thing in the same function,
93-
disambiguation on the content should be done. For example:
94-
- `timestampAsMoment` vs `timestampAsString`
95-
- `stopSequenceAsString` vs `stopSequenceAsInt`
96-
97100
With some reasonable limits, one shouldn't be afraid to have long variable name, and be more afraid
98101
of meaningless names. For example:
99102
- `apiStopByStopIdByTripHeadsignByRouteId` should be still preferred as `dict` or `apiStops`.

0 commit comments

Comments
 (0)