Collection debug methods, remove deleteAll (#2577)

This commit is contained in:
1Computer1
2018-08-09 08:25:07 -04:00
committed by Crawl
parent 55863efa15
commit 8e0ea9aa16

View File

@@ -333,12 +333,29 @@ class Collection extends Map {
* @returns {Collection}
* @example
* collection
* .tap(user => console.log(user.username))
* .each(user => console.log(user.username))
* .filter(user => user.bot)
* .tap(user => console.log(user.username));
* .each(user => console.log(user.username));
*/
each(fn, thisArg) {
this.forEach(fn, thisArg);
return this;
}
/**
* Runs a function on the collection and returns the collection.
* @param {Function} fn Function to execute
* @param {*} [thisArg] Value to use as `this` when executing function
* @returns {Collection}
* @example
* collection
* .tap(coll => coll.size)
* .filter(user => user.bot)
* .tap(coll => coll.size)
*/
tap(fn, thisArg) {
this.forEach(fn, thisArg);
if (typeof thisArg !== 'undefined') fn = fn.bind(thisArg);
fn(this);
return this;
}
@@ -365,18 +382,6 @@ class Collection extends Map {
return newColl;
}
/**
* Calls the `delete()` method on all items that have it.
* @returns {Promise[]}
*/
deleteAll() {
const returns = [];
for (const item of this.values()) {
if (item.delete) returns.push(item.delete());
}
return returns;
}
/**
* Checks if this collection shares identical key-value pairings with another.
* This is different to checking for equality using equal-signs, because