mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-14 10:33:30 +01:00
Teensy reorganisation
This commit is contained in:
@@ -81,19 +81,6 @@ class Collection extends Map {
|
|||||||
return arr[Math.floor(Math.random() * arr.length)];
|
return arr[Math.floor(Math.random() * arr.length)];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* If the items in this collection have a delete method (e.g. messages), invoke
|
|
||||||
* the delete method. Returns an array of promises
|
|
||||||
* @returns {Promise[]}
|
|
||||||
*/
|
|
||||||
deleteAll() {
|
|
||||||
const returns = [];
|
|
||||||
for (const item of this.values()) {
|
|
||||||
if (item.delete) returns.push(item.delete());
|
|
||||||
}
|
|
||||||
return returns;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array of items where `item[prop] === value` of the collection
|
* Returns an array of items where `item[prop] === value` of the collection
|
||||||
* @param {string} prop The property to test against
|
* @param {string} prop The property to test against
|
||||||
@@ -262,6 +249,19 @@ class Collection extends Map {
|
|||||||
for (const [key, val] of this) currentVal = fn(currentVal, val, key, this);
|
for (const [key, val] of this) currentVal = fn(currentVal, val, key, this);
|
||||||
return currentVal;
|
return currentVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the items in this collection have a delete method (e.g. messages), invoke
|
||||||
|
* the delete method. Returns an array of promises
|
||||||
|
* @returns {Promise[]}
|
||||||
|
*/
|
||||||
|
deleteAll() {
|
||||||
|
const returns = [];
|
||||||
|
for (const item of this.values()) {
|
||||||
|
if (item.delete) returns.push(item.delete());
|
||||||
|
}
|
||||||
|
return returns;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Collection;
|
module.exports = Collection;
|
||||||
|
|||||||
Reference in New Issue
Block a user