Webpack build for branch custom-structures: f004e6ccca

This commit is contained in:
Travis CI 2017-11-20 04:06:09 +00:00
parent e855a4b0e4
commit b231d6e992
2 changed files with 13 additions and 2 deletions

View file

@ -1664,7 +1664,7 @@ class DataStore extends Collection {
constructor(client, iterable, holds) {
super();
Object.defineProperty(this, 'client', { value: client });
Object.defineProperty(this, 'holds', { value: Structures.get(holds.name) });
Object.defineProperty(this, 'holds', { value: Structures.get(holds) });
if (iterable) for (const item of iterable) this.create(item);
}
@ -9608,6 +9608,17 @@ class Structures {
throw new Error(`The ${this.constructor.name} class may not be instantiated.`);
}
/**
* Retrieves a structure class.
* @param {string|Function} structure Name of the structure or a class/prototype function to use the name of
* @returns {Function}
*/
static get(structure) {
if (typeof structure === 'string') return structures[structure];
if (typeof structure === 'function') return structures[structure.name];
throw new TypeError(`Structure to retrieve must be a string or class/prototype function, not ${typeof structure}.`);
}
/**
* Extends a structure.
* @param {string} name Name of the structure class to extend

File diff suppressed because one or more lines are too long