mirror of
https://github.com/kettanaito/naming-cheatsheet.git
synced 2025-08-08 22:44:42 +02:00
Update README.md
This commit is contained in:
committed by
GitHub
parent
d75d867ea5
commit
96b71a8c14
22
README.md
22
README.md
@ -110,14 +110,17 @@ link.addEventListener('click', handleLinkClick);
|
||||
```
|
||||
|
||||
## Prefixes
|
||||
Prefixes enhance variables/methods, and serve as a quick indicators of additional meaning behind them.
|
||||
|
||||
#### `is`
|
||||
Describes certain characteristic of the context.
|
||||
Describes certain characteristic or state of the context.
|
||||
```js
|
||||
const color = 'blue';
|
||||
const isBlue = (color === 'blue');
|
||||
const isBlue = (color === 'blue'); // characteristic
|
||||
const isRemoved = false; // state
|
||||
|
||||
if (isBlue) {
|
||||
console.log('The color is blue!');
|
||||
if (isBlue && !isRemoved) {
|
||||
console.log('The color is blue and it is present!');
|
||||
}
|
||||
```
|
||||
|
||||
@ -130,6 +133,17 @@ function PostsList() {
|
||||
}
|
||||
```
|
||||
|
||||
#### `has`
|
||||
Describes whether current context possesses a certain value or state.
|
||||
```js
|
||||
/* Bad */
|
||||
const isProductsExist = (productsCount > 0);
|
||||
const areProductsPresent = (productsCount > 0);
|
||||
|
||||
/* Good */
|
||||
const hasProducts = (productsCount > 0);
|
||||
```
|
||||
|
||||
#### `should`
|
||||
Reflects conditional statement (returns `Boolean` value).
|
||||
```js
|
||||
|
Reference in New Issue
Block a user