Class: Doc
Hierarchy​
↳
Doc
Constructors​
constructor​
• new Doc(url
, docs
)
Parameters​
Name | Type |
---|---|
url | string |
docs | Documentation |
Overrides​
Defined in​
lib/Doc.ts:45
Properties​
baseURL​
• Readonly
baseURL: string
= 'https://discord.js.org'
The documentation base URL.
Defined in​
lib/Doc.ts:24
branch​
• Readonly
branch: string
The branch dissected from the url.
Defined in​
lib/Doc.ts:36
children​
• children: Map
<string
, DocEvent
| DocMethod
| DocParam
| DocProp
>
The children that belong to this element
Inherited from​
Defined in​
lib/elements/Base.ts:16
docType​
• docType: null
| DocTypes
The type of this element
Inherited from​
Defined in​
lib/elements/Base.ts:19
name​
• name: null
| string
The name of this element
Inherited from​
Defined in​
lib/elements/Base.ts:22
project​
• Readonly
project: string
The project dissected from the url.
Defined in​
lib/Doc.ts:28
repo​
• Readonly
repo: string
The repository dissected from the url.
Defined in​
lib/Doc.ts:32
url​
• Readonly
url: string
The raw URL of the JSON that was fetched
Defined in​
lib/Doc.ts:40
globalOptions​
â–ª Static
globalOptions: DocParserGlobalOptions
Global options to configure the Doc output
property
escapeMarkdownLinks Whether to escape markdown links in the output. (default: false
)
property
descriptionLimit The maximum number of characters to show in the description. (default: 1500
)
Defined in​
lib/Doc.ts:182
Accessors​
baseDocsURL​
• get
baseDocsURL(): string
Returns​
string
Defined in​
lib/Doc.ts:62
classes​
• get
classes(): null
| DocClass
[]
The stored Classes for this current documentation source
Returns​
null
| DocClass
[]
Inherited from​
DocBase.classes
Defined in​
lib/elements/Base.ts:78
events​
• get
events(): null
| DocEvent
[]
The stored Events for this current documentation source
Returns​
null
| DocEvent
[]
Inherited from​
DocBase.events
Defined in​
lib/elements/Base.ts:118
interfaces​
• get
interfaces(): null
| DocInterface
[]
The stored Interfaces for this current documentation source
Returns​
null
| DocInterface
[]
Inherited from​
DocBase.interfaces
Defined in​
lib/elements/Base.ts:94
methods​
• get
methods(): null
| DocMethod
[]
The stored Methods for this current documentation source
Returns​
null
| DocMethod
[]
Inherited from​
DocBase.methods
Defined in​
lib/elements/Base.ts:110
params​
• get
params(): null
| DocParam
[]
The stored Params for this current documentation source
Returns​
null
| DocParam
[]
Inherited from​
DocBase.params
Defined in​
lib/elements/Base.ts:126
props​
• get
props(): null
| DocProp
[]
The stored Props for this current documentation source
Returns​
null
| DocProp
[]
Inherited from​
DocBase.props
Defined in​
lib/elements/Base.ts:102
repoURL​
• get
repoURL(): string
Returns​
string
Defined in​
lib/Doc.ts:58
typedefs​
• get
typedefs(): null
| DocTypedef
[]
The stored Typedefs for this current documentation source
Returns​
null
| DocTypedef
[]
Inherited from​
DocBase.typedefs
Defined in​
lib/elements/Base.ts:86
Methods​
get​
â–¸ get(...terms
): null
| DocElement
Gets the documentation for one element.
example
doc.get('message');
doc.get('message', 'guild');
doc.get('message', 'guild', 'members');
Parameters​
Name | Type | Description |
---|---|---|
...terms | (string | (null | DocElement )[])[] | The terms that lead to the element to get. Use multiple terms to get a nested element. |
Returns​
null
| DocElement
Either the element or null if it doesn't exist.
Defined in​
lib/Doc.ts:77
search​
â–¸ search(query
, searchOptions?
): null
| DocElement
[]
Searches the documentation for elements matching the provided search query.
This uses the Jaro Winkler Distance algorithm to fuzzily match your query against any potential matches. The minimum threshold for a match is 80%
example
doc.search('message.guild');
doc.search('message.client');
doc.search('message.guild.members');
Parameters​
Name | Type | Description |
---|---|---|
query | string | The query to use in the fuzzy search. |
searchOptions | SearchOptions | Additional options to pass to the search function. |
Returns​
null
| DocElement
[]
The top 10 hits from the search.
Defined in​
lib/Doc.ts:121
fetch​
â–¸ Static
fetch(sourceName
, fetchOptions?
): Promise
<Doc
>
Fetches the documentation JSON file and builds up a Doc object.
example
const { Doc } = require('discordjs-docs-parser');
const doc = await Doc.fetch('stable');
example
import { Doc } from 'discordjs-docs-parser';
const doc = await Doc.fetch('collection', { force: true });
Parameters​
Name | Type | Description |
---|---|---|
sourceName | SourcesStringUnion | The name of the source to fetch. |
fetchOptions | FetchOptions | Additional options to pass to the fetch function. |
Returns​
Promise
<Doc
>
An instance of Doc
Defined in​
lib/Doc.ts:216
setGlobalOptions​
â–¸ Static
setGlobalOptions(options
): void
Sets the Doc.globalOptions. You can provide a partial of the options to update.
Parameters​
Name | Type | Description |
---|---|---|
options | Partial <DocParserGlobalOptions > | The DocParserGlobalOptions to set |
Returns​
void
Defined in​
lib/Doc.ts:191