Skip to content

Commit fb8059a

Browse files
committed
Project Cleanup
1 parent 93d6068 commit fb8059a

File tree

11 files changed

+518
-304
lines changed

11 files changed

+518
-304
lines changed

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
[*]
7+
indent_style = space
8+
indent_size = 2
9+
end_of_line = crlf
10+
charset = utf-8
11+
trim_trailing_whitespace = false
12+
insert_final_newline = false

.prettierrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
"useTabs": false,
1111
"tabWidth": 2,
1212
"semi": true
13-
}
13+
}

.vscode/extensions.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"recommendations": [
3+
"editorconfig.editorconfig",
4+
"dbaeumer.vscode-eslint",
5+
"esbenp.prettier-vscode",
6+
"eamodio.gitlens",
7+
"aaron-bond.better-comments"
8+
]
9+
}

README.md

Lines changed: 36 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -7,76 +7,82 @@ A parser and wrapper for the [discord.js](https://github.com/discordjs/discord.j
77
### Doc
88

99
```js
10-
const Doc = require('discord.js-docs')
10+
const Doc = require('discord.js-docs');
1111
```
1212

1313
### Doc.fetch(sourceName[, options])
14+
1415
Fetches and parses the docs for the given project.\
15-
`sourceName` can be any of the predefined values (`stable`, `main`, `commando`, `rpc`, `akairo`, `collection`, `builders`, `voice` and `rest`)
16-
or an URL which will return the raw generated docs (e.g https://raw.githubusercontent.com/discordjs/docs/main/discord.js/main.json ).\
16+
`sourceName` can be any of the predefined values (`stable`, `main`, `commando`, `rpc`, `akairo`, `collection`,
17+
`builders`, `voice` and `rest`) or an URL which will return the raw generated docs (e.g
18+
https://raw.githubusercontent.com/discordjs/docs/main/discord.js/main.json ).\
1719
Once a documentation is fetched it will be cached. Use `options.force` to avoid this behavior.
1820

1921
**Params**:
2022

21-
|name |type |required|
22-
|:---------:|:----:|:------:|
23-
|sourceName |string|yes |
24-
|options |object|no |
23+
| name | type | required |
24+
| :--------: | :----: | :------: |
25+
| sourceName | string | yes |
26+
| options | object | no |
2527

2628
**Returns**: `Promise<Doc?>`
2729

2830
```js
29-
const doc = await Doc.fetch('main')
30-
const doc = await Doc.fetch('akairo', { force: true })
31-
const doc = await Doc.fetch(
32-
'https://raw.githubusercontent.com/discordjs/rpc/docs/master.json',
33-
{ force: true }
34-
)
31+
const doc = await Doc.fetch('main');
32+
const doc = await Doc.fetch('akairo', { force: true });
33+
const doc = await Doc.fetch('https://raw.githubusercontent.com/discordjs/rpc/docs/master.json', { force: true });
3534
```
3635

3736
### Doc#get(parent[, child1[ ...[, childN]]])
38-
Gets documention for one element. Multiple properties/methods can be chained.
39-
**Params**:
4037

41-
|name |type |required|
42-
|:---------:|:----:|:------:|
43-
|parent |string|yes |
44-
|...children|string|no |
38+
Gets documention for one element. Multiple properties/methods can be chained. **Params**:
39+
40+
| name | type | required |
41+
| :---------: | :----: | :------: |
42+
| parent | string | yes |
43+
| ...children | string | no |
4544

4645
**Returns**: `DocElement?`
4746

4847
```js
49-
doc.get('message')
50-
doc.get('message', 'guild')
51-
doc.get('message', 'guild', 'members')
48+
doc.get('message');
49+
doc.get('message', 'guild');
50+
doc.get('message', 'guild', 'members');
5251
```
5352

5453
### Doc#search(query)
54+
5555
Searches the documentation using fuzzy search for the given query and returns top 10 hits.
5656

5757
**Params**:
5858

59-
|name |type |required|
60-
|:-----:|:----:|:------:|
61-
|query |string|yes |
59+
| name | type | required |
60+
| :---: | :----: | :------: |
61+
| query | string | yes |
6262

6363
**Returns**: `Array<DocElement>?`
6464

6565
### Doc#resolveEmbed(query)
66-
Tries to resolve the query into a `DocElement` using `Doc#get`. The search terms are expected to be separated by `#` or `.`, example: `message#pin`. If an element cannot be resolved, falls back to `Doc#search`. The result is then formatted into an object representing a Discord embed which can be sent directly to a Discord channel.
66+
67+
Tries to resolve the query into a `DocElement` using `Doc#get`. The search terms are expected to be separated by `#` or
68+
`.`, example: `message#pin`. If an element cannot be resolved, falls back to `Doc#search`. The result is then formatted
69+
into an object representing a Discord embed which can be sent directly to a Discord channel.
6770

6871
**Params**:
6972

70-
|name |type |required|
71-
|:-----:|:----:|:------:|
72-
|query |string|yes |
73+
| name | type | required |
74+
| :---: | :----: | :------: |
75+
| query | string | yes |
7376

7477
**Returns**: `object?`
7578

7679
### DocElement
80+
7781
#### Properties:
82+
7883
- `doc` - the Doc this element originates from;
79-
- `docType` - the type of this documentation element. One of `class`, `event`, `interface`, `method`, `param`, `prop` and `typedef`;
84+
- `docType` - the type of this documentation element. One of `class`, `event`, `interface`, `method`, `param`, `prop`
85+
and `typedef`;
8086
- `parent` - parent element if present;
8187
- `name` - self-explanatory;
8288
- `description` - self-explanatory;
@@ -87,11 +93,3 @@ Tries to resolve the query into a `DocElement` using `Doc#get`. The search terms
8793
- `nullable` - tells whether this element can be null;
8894
- `deprecated` - tells whether this element has been deprecated;
8995
- `access` - access level for this element. Defaults to `public`;
90-
91-
92-
93-
94-
95-
96-
97-

eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,4 @@ export default [
6262
semi: 'error'
6363
}
6464
}
65-
];
65+
];

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module.exports = require('./src/Doc')
1+
module.exports = require('./src/Doc');

0 commit comments

Comments
 (0)