fix(Guild): equals method modifying features array of guild (#2544)

* Fixed a bug where Guild#equals would cause the given guild to lose its features

* Fix Util.arraysEqual

* Fixed docs for Util.arraysEqual

* Remove Util.arraysEqual
This commit is contained in:
Kyra
2018-05-29 11:15:19 +02:00
committed by SpaceEEC
parent 30c7d6d1b1
commit d02c303afd
2 changed files with 5 additions and 21 deletions

View File

@@ -118,25 +118,6 @@ class Util {
return { animated: Boolean(m[1]), name: m[2], id: m[3] };
}
/**
* Checks whether the arrays are equal, also removes duplicated entries from b.
* @param {Array<*>} a Array which will not be modified.
* @param {Array<*>} b Array to remove duplicated entries from.
* @returns {boolean} Whether the arrays are equal.
* @private
*/
static arraysEqual(a, b) {
if (a === b) return true;
if (a.length !== b.length) return false;
for (const item of a) {
const ind = b.indexOf(item);
if (ind !== -1) b.splice(ind, 1);
}
return b.length === 0;
}
/**
* Shallow-copies an object with its class/prototype intact.
* @param {Object} obj Object to clone