27 lines
723 B
JavaScript
27 lines
723 B
JavaScript
/**
|
|
* BetterDiscord List
|
|
* Copyright (c) 2015-present Jiiks/JsSucks - https://github.com/Jiiks / https://github.com/JsSucks
|
|
* All rights reserved.
|
|
* https://betterdiscord.net
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
export default class List extends Array {
|
|
|
|
get(...filters) {
|
|
return this.find(item => {
|
|
for (const filter of filters) {
|
|
for (const key in filter) {
|
|
if (filter.hasOwnProperty(key)) {
|
|
if (item[key] !== filter[key]) return false;
|
|
}
|
|
}
|
|
}
|
|
return true;
|
|
});
|
|
}
|
|
|
|
}
|