mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23:30 +01:00
fix(LimitedCollection): allow items to be stored if keepOverLimit is true when maxSize is 0 (#9534)
Update LimitedCollection.js Keep value if it matches the limit. Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
@@ -47,7 +47,7 @@ class LimitedCollection extends Collection {
|
||||
}
|
||||
|
||||
set(key, value) {
|
||||
if (this.maxSize === 0) return this;
|
||||
if (this.maxSize === 0 && !this.keepOverLimit?.(value, key, this)) return this;
|
||||
if (this.size >= this.maxSize && !this.has(key)) {
|
||||
for (const [k, v] of this.entries()) {
|
||||
const keep = this.keepOverLimit?.(v, k, this) ?? false;
|
||||
|
||||
Reference in New Issue
Block a user