Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time/Duration naming convention #30

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

- [English language](#english-language)
- [Naming convention](#naming-convention)
- [Time/Duration naming convention](#timeduration-naming-convention)
- [S-I-D](#s-i-d)
- [Avoid contractions](#avoid-contractions)
- [Avoid context duplication](#avoid-context-duplication)
Expand Down Expand Up @@ -59,6 +60,23 @@ const page_count = 5
const should_update = true
```

## Time/Duration naming convention

Name your variables with **units**. For timestamps, if not using a native date/timestamp type, be sure to have something like `seconds` or `ns`.

```js
/* Bad */
const startAt = Date.now()
const delay = 5

/* Good */
const startAtUnixMilliseconds = Date.now()
const delaySeconds = 5

/* Good as well */
const start_at_unix_ms = Date.now()
```

## S-I-D

A name must be _short_, _intuitive_ and _descriptive_:
Expand Down