mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 01:23:31 +01:00
refactor: make LimitedCollection an implementation detail (#3872)
This commit is contained in:
@@ -8,6 +8,7 @@ const Collection = require('./Collection.js');
|
||||
* @extends {Collection}
|
||||
* @param {number} [maxSize=0] The maximum size of the Collection
|
||||
* @param {Iterable} [iterable=null] Optional entries passed to the Map constructor.
|
||||
* @private
|
||||
*/
|
||||
class LimitedCollection extends Collection {
|
||||
constructor(maxSize = 0, iterable = null) {
|
||||
@@ -24,6 +25,10 @@ class LimitedCollection extends Collection {
|
||||
if (this.size >= this.maxSize && !this.has(key)) this.delete(this.firstKey());
|
||||
return super.set(key, value);
|
||||
}
|
||||
|
||||
static get [Symbol.species]() {
|
||||
return Collection;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = LimitedCollection;
|
||||
|
||||
Reference in New Issue
Block a user