mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
Fixed some caching issues and list issue
When leaving a server, it is now removed from the known list. Also, the list "removeElement" function is improved to actually work!
This commit is contained in:
16
lib/list.js
16
lib/list.js
@@ -28,14 +28,14 @@ exports.List.prototype.removeIndex = function( index ) {
|
||||
|
||||
exports.List.prototype.removeElement = function( child ) {
|
||||
|
||||
var index = this.contents.indexOf( child );
|
||||
|
||||
if ( index === -1 ) {
|
||||
return false;
|
||||
for ( _element in this.contents ) {
|
||||
var element = this.contents[_element];
|
||||
if ( child[ this.discriminator ] == element[ this.discriminator ] ) {
|
||||
this.removeIndex( _element, 1 );
|
||||
}
|
||||
}
|
||||
|
||||
this.removeIndex( index );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
exports.List.prototype.concatSublists = function( whereList, discriminator ) {
|
||||
@@ -81,8 +81,8 @@ exports.List.prototype.deepFilter = function( keys, value, onlyOne ) {
|
||||
var child = this.contents[ index ];
|
||||
var buffer = child;
|
||||
|
||||
for(key of keys){
|
||||
buffer = buffer[key];
|
||||
for ( key of keys ) {
|
||||
buffer = buffer[ key ];
|
||||
}
|
||||
|
||||
if ( buffer == value ) {
|
||||
|
||||
Reference in New Issue
Block a user