Teensy reorganisation

This commit is contained in:
Schuyler Cebulskie
2016-09-12 21:40:15 -04:00
parent ac85ffce4b
commit 9cd249342b

View File

@@ -81,19 +81,6 @@ class Collection extends Map {
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
* @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);
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;