mirror of
https://github.com/danbulant/discord.js
synced 2026-07-07 12:11:11 +00:00
Make Collection.find and findAll use .values() (#567)
* Make Collection.find and findAll use .values() * Make Collection.deleteAll use .values()
This commit is contained in:
parent
60a1ba3088
commit
56352220af
1 changed files with 3 additions and 3 deletions
|
|
@ -51,7 +51,7 @@ class Collection extends Map {
|
||||||
*/
|
*/
|
||||||
deleteAll() {
|
deleteAll() {
|
||||||
const returns = [];
|
const returns = [];
|
||||||
for (const item of this.array()) {
|
for (const item of this.values()) {
|
||||||
if (item.delete) {
|
if (item.delete) {
|
||||||
returns.push(item.delete());
|
returns.push(item.delete());
|
||||||
}
|
}
|
||||||
|
|
@ -78,7 +78,7 @@ class Collection extends Map {
|
||||||
*/
|
*/
|
||||||
findAll(key, value) {
|
findAll(key, value) {
|
||||||
const results = [];
|
const results = [];
|
||||||
for (const item of this.array()) {
|
for (const item of this.values()) {
|
||||||
if (item[key] === value) {
|
if (item[key] === value) {
|
||||||
results.push(item);
|
results.push(item);
|
||||||
}
|
}
|
||||||
|
|
@ -95,7 +95,7 @@ class Collection extends Map {
|
||||||
* collection.get('id', '123123...');
|
* collection.get('id', '123123...');
|
||||||
*/
|
*/
|
||||||
find(key, value) {
|
find(key, value) {
|
||||||
for (const item of this.array()) {
|
for (const item of this.values()) {
|
||||||
if (item[key] === value) {
|
if (item[key] === value) {
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue