Adds table of contents

This commit is contained in:
Artem Zakharchenko
2021-01-16 17:24:31 +01:00
parent 96dea1d185
commit 4a57f1d9ce

View File

@ -6,6 +6,20 @@
# Naming cheatsheet # Naming cheatsheet
- [Naming convention](#naming-convention)
- [S-I-D](#s-i-d)
- [Avoid contractions](#avoid-contractions)
- [Avoid context duplication](#avoid-context-duplication)
- [Reflect expected result](#reflect-expected-result)
- Naming functions
- [A/HC/LC pattern](#ahclc-pattern)
- [Actions](#actions)
- [Context](#context)
- [Prefixes](#prefixes)
- [Singular and Plurals](#singular-and-plurals)
---
Naming things is hard. This sheet attempts to make it easier. Naming things is hard. This sheet attempts to make it easier.
Although these suggestions can be applied to any programming language, I will use JavaScript to illustrate them in practice. Although these suggestions can be applied to any programming language, I will use JavaScript to illustrate them in practice.
@ -250,7 +264,7 @@ function getRecentPosts(posts) {
> Some language-specific assumptions may allow omitting the context. For example, in JavaScript, it's common that `filter` operates on Array. Adding explicit `filterArray` would be unnecessary. > Some language-specific assumptions may allow omitting the context. For example, in JavaScript, it's common that `filter` operates on Array. Adding explicit `filterArray` would be unnecessary.
--- --
## Prefixes ## Prefixes
@ -322,7 +336,7 @@ function fetchPosts() {
} }
``` ```
## Singular/Plurals ## Singular and Plurals
Like a prefix, variable names can be made singular or plural depending on whether they hold a single value or multiple values. Like a prefix, variable names can be made singular or plural depending on whether they hold a single value or multiple values.