mirror of
https://github.com/kettanaito/naming-cheatsheet.git
synced 2025-08-09 14:55:01 +02:00
Updates README
This commit is contained in:
16
README.md
16
README.md
@ -113,7 +113,7 @@ In other words, **high context emphasizes the meaning of a variable**.
|
|||||||
|
|
||||||
The verb part of your function name. The most important part responsible for describing what the function *does*.
|
The verb part of your function name. The most important part responsible for describing what the function *does*.
|
||||||
|
|
||||||
#### `get`
|
### `get`
|
||||||
Accesses data immediately (i.e. shorthand getter of internal data).
|
Accesses data immediately (i.e. shorthand getter of internal data).
|
||||||
```js
|
```js
|
||||||
function getFruitsCount() {
|
function getFruitsCount() {
|
||||||
@ -121,7 +121,7 @@ function getFruitsCount() {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
#### `set`
|
### `set`
|
||||||
Declaratively sets a variable with value `A` to value `B`.
|
Declaratively sets a variable with value `A` to value `B`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
@ -135,7 +135,7 @@ setFruits(5)
|
|||||||
console.log(fruits) // 5
|
console.log(fruits) // 5
|
||||||
```
|
```
|
||||||
|
|
||||||
#### `reset`
|
### `reset`
|
||||||
Sets a variable back to its initial value or state.
|
Sets a variable back to its initial value or state.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
@ -152,7 +152,7 @@ resetFruits()
|
|||||||
console.log(fruits) // 5
|
console.log(fruits) // 5
|
||||||
```
|
```
|
||||||
|
|
||||||
#### `fetch`
|
### `fetch`
|
||||||
Requests for a data, which takes time (i.e. async request).
|
Requests for a data, which takes time (i.e. async request).
|
||||||
```js
|
```js
|
||||||
function fetchPosts(postCount) {
|
function fetchPosts(postCount) {
|
||||||
@ -160,7 +160,7 @@ function fetchPosts(postCount) {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
#### `remove`
|
### `remove`
|
||||||
Removes something *from* somewhere.
|
Removes something *from* somewhere.
|
||||||
|
|
||||||
For example, if you have a collection of selected filters on a search page, removing one of them from the collection is `removeFilter`, **not** `deleteFilter` (and this is how you would naturally say it in English as well):
|
For example, if you have a collection of selected filters on a search page, removing one of them from the collection is `removeFilter`, **not** `deleteFilter` (and this is how you would naturally say it in English as well):
|
||||||
@ -179,7 +179,7 @@ function removeFilter(filterName) {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
#### `delete`
|
### `delete`
|
||||||
Completely erazes something from the realms of existance.
|
Completely erazes something from the realms of existance.
|
||||||
|
|
||||||
Imagine you are a content editor, and there is that notorious post you wish to get rid of. Once you clicked a shiny "Delete post" button, the CMS performed a `deletePost` action, **not** `removePost`.
|
Imagine you are a content editor, and there is that notorious post you wish to get rid of. Once you clicked a shiny "Delete post" button, the CMS performed a `deletePost` action, **not** `removePost`.
|
||||||
@ -190,7 +190,7 @@ function deletePost(id) {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
#### `compose`
|
### `compose`
|
||||||
Creates a new data from the existing one. Mostly applicable to strings or objects.
|
Creates a new data from the existing one. Mostly applicable to strings or objects.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
@ -199,7 +199,7 @@ function composePageUrl(pageName, pageId) {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
#### `handle`
|
### `handle`
|
||||||
Handles a dedicated action. Often used in naming the callback methods.
|
Handles a dedicated action. Often used in naming the callback methods.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
Reference in New Issue
Block a user