2020-05-31 15:21:17 +00:00
|
|
|
## Flagger
|
2020-05-29 08:59:50 +00:00
|
|
|
|
2020-05-31 15:21:17 +00:00
|
|
|
### Instructions
|
2020-05-29 08:59:50 +00:00
|
|
|
|
2022-06-19 20:59:12 +00:00
|
|
|
Create a function named `flags` that receives an object and returns the specific aliases and descriptions from the properties of that object.
|
2020-05-29 08:59:50 +00:00
|
|
|
|
|
|
|
The `help` flag:
|
2021-04-27 19:04:54 +00:00
|
|
|
|
2022-06-19 20:59:12 +00:00
|
|
|
- Must be present in the **output** by default.
|
2021-04-27 19:04:54 +00:00
|
|
|
- When not present in the input, it should return the description of all flags.
|
2022-06-19 20:59:12 +00:00
|
|
|
- When present in the input, it specifies the descriptions of the flags that are passed to `help`. (ex: `help: ['divide']`)
|
2020-05-29 08:59:50 +00:00
|
|
|
|
|
|
|
#### Example:
|
|
|
|
|
|
|
|
```js
|
|
|
|
{
|
|
|
|
multiply: 'multiply the values',
|
|
|
|
divide: 'divides the values',
|
|
|
|
help: ['divide']
|
|
|
|
}
|
|
|
|
```
|
2021-04-27 19:04:54 +00:00
|
|
|
|
2020-05-29 08:59:50 +00:00
|
|
|
and outputs :
|
|
|
|
|
|
|
|
```js
|
|
|
|
{
|
|
|
|
alias: { h: 'help', m: 'multiply', d: 'divide'}
|
|
|
|
description: '-d, --divide: divides the values',
|
|
|
|
}
|
2020-06-23 12:36:08 +00:00
|
|
|
```
|