mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-20 13:33:30 +01:00
Add constructor documentation
This commit is contained in:
@@ -14,5 +14,6 @@ module.exports = {
|
|||||||
"no-param-reassign": 0,
|
"no-param-reassign": 0,
|
||||||
"consistent-return": 0,
|
"consistent-return": 0,
|
||||||
"import/no-extraneous-dependencies": 0,
|
"import/no-extraneous-dependencies": 0,
|
||||||
|
"no-continue": 0,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
File diff suppressed because one or more lines are too long
@@ -51,14 +51,16 @@ function cleanPaths() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function clean() {
|
function firstPass() {
|
||||||
const cleaned = {
|
const cleaned = {
|
||||||
classes: {},
|
classes: {},
|
||||||
interfaces: {},
|
interfaces: {},
|
||||||
typedefs: {},
|
typedefs: {},
|
||||||
};
|
};
|
||||||
for (const item of json) {
|
for (const itemID in json) {
|
||||||
|
const item = json[itemID];
|
||||||
if (item.kind === 'class') {
|
if (item.kind === 'class') {
|
||||||
|
delete json[itemID];
|
||||||
cleaned.classes[item.longname] = {
|
cleaned.classes[item.longname] = {
|
||||||
meta: item,
|
meta: item,
|
||||||
functions: [],
|
functions: [],
|
||||||
@@ -66,13 +68,25 @@ function clean() {
|
|||||||
events: [],
|
events: [],
|
||||||
};
|
};
|
||||||
} else if (item.kind === 'interface') {
|
} else if (item.kind === 'interface') {
|
||||||
|
delete json[itemID];
|
||||||
cleaned.interfaces[item.longname] = {
|
cleaned.interfaces[item.longname] = {
|
||||||
meta: item,
|
meta: item,
|
||||||
functions: [],
|
functions: [],
|
||||||
properties: [],
|
properties: [],
|
||||||
events: [],
|
events: [],
|
||||||
};
|
};
|
||||||
} else if (item.kind === 'member') {
|
}
|
||||||
|
}
|
||||||
|
return cleaned;
|
||||||
|
}
|
||||||
|
|
||||||
|
function clean() {
|
||||||
|
const cleaned = firstPass();
|
||||||
|
for (const item of json) {
|
||||||
|
if (!item) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (item.kind === 'member') {
|
||||||
const obj = cleaned.classes[item.memberof] || cleaned.interfaces[item.memberof];
|
const obj = cleaned.classes[item.memberof] || cleaned.interfaces[item.memberof];
|
||||||
const newTypes = [];
|
const newTypes = [];
|
||||||
for (const name of item.type.names) {
|
for (const name of item.type.names) {
|
||||||
@@ -97,6 +111,9 @@ function clean() {
|
|||||||
obj.functions.push(item);
|
obj.functions.push(item);
|
||||||
} else if (item.kind === 'typedef') {
|
} else if (item.kind === 'typedef') {
|
||||||
cleaned.typedefs[item.longname] = item;
|
cleaned.typedefs[item.longname] = item;
|
||||||
|
} else if (item.kind === 'constructor') {
|
||||||
|
const obj = cleaned.classes[item.memberof] || cleaned.interfaces[item.memberof];
|
||||||
|
obj.constructor = item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
json = cleaned;
|
json = cleaned;
|
||||||
|
|||||||
@@ -17,6 +17,10 @@ const ActionsManager = require('./actions/ActionsManager');
|
|||||||
*/
|
*/
|
||||||
class Client extends EventEmitter {
|
class Client extends EventEmitter {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an instance of Client.
|
||||||
|
* @param {Object} [options] options to pass to the client
|
||||||
|
*/
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
super();
|
super();
|
||||||
this.options = mergeDefault(Constants.DefaultOptions, options);
|
this.options = mergeDefault(Constants.DefaultOptions, options);
|
||||||
|
|||||||
Reference in New Issue
Block a user