mirror of
https://github.com/kettanaito/naming-cheatsheet.git
synced 2025-08-09 14:55:01 +02:00
Update README.md
This commit is contained in:
committed by
GitHub
parent
32db25af2a
commit
d75d867ea5
33
README.md
33
README.md
@ -37,12 +37,11 @@ const isDisabled = this.props.disabled;
|
|||||||
return (<Button disabled={isDisabled} />);
|
return (<Button disabled={isDisabled} />);
|
||||||
```
|
```
|
||||||
|
|
||||||
## Methods
|
## Pattern
|
||||||
### Pattern
|
|
||||||
```
|
```
|
||||||
prefix? + action (A) + high context (HC) + low context (LC)
|
prefix? + action (A) + high context (HC) + low context (LC)
|
||||||
```
|
```
|
||||||
#### Example
|
### Example
|
||||||
| Name | Prefix | Action | High context | Low context |
|
| Name | Prefix | Action | High context | Low context |
|
||||||
| ---- | ---- | ------ | ------------ | ----------- |
|
| ---- | ---- | ------ | ------------ | ----------- |
|
||||||
| `getPost` | | `get` | `Post` | |
|
| `getPost` | | `get` | `Post` | |
|
||||||
@ -50,7 +49,9 @@ prefix? + action (A) + high context (HC) + low context (LC)
|
|||||||
| `handleClickOutside` | | `handle` | `Click` | `Outside` |
|
| `handleClickOutside` | | `handle` | `Click` | `Outside` |
|
||||||
| `shouldDisplayMessage` | `should` | `Display` | `Message`| |
|
| `shouldDisplayMessage` | `should` | `Display` | `Message`| |
|
||||||
|
|
||||||
### Actions
|
## Naming methods
|
||||||
|
|
||||||
|
### Action
|
||||||
#### `get`
|
#### `get`
|
||||||
Access data immediately (i.e. shorthand getter of internal data).
|
Access data immediately (i.e. shorthand getter of internal data).
|
||||||
```js
|
```js
|
||||||
@ -108,9 +109,29 @@ function handleLinkClick(event) {
|
|||||||
link.addEventListener('click', handleLinkClick);
|
link.addEventListener('click', handleLinkClick);
|
||||||
```
|
```
|
||||||
|
|
||||||
### Prefixes
|
## Prefixes
|
||||||
|
#### `is`
|
||||||
|
Describes certain characteristic of the context.
|
||||||
|
```js
|
||||||
|
const color = 'blue';
|
||||||
|
const isBlue = (color === 'blue');
|
||||||
|
|
||||||
|
if (isBlue) {
|
||||||
|
console.log('The color is blue!');
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `min`/`max`
|
||||||
|
Represent minimum or maximum value. Usually describe allowed limits.
|
||||||
|
```js
|
||||||
|
function PostsList() {
|
||||||
|
this.minPosts = 3;
|
||||||
|
this.maxPosts = 10;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
#### `should`
|
#### `should`
|
||||||
Prompting computation usually returninng `Boolean` value.
|
Reflects conditional statement (returns `Boolean` value).
|
||||||
```js
|
```js
|
||||||
const currentUrl = 'https://dev.com';
|
const currentUrl = 'https://dev.com';
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user