mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 03:23:29 +01:00
More rewrites
This commit is contained in:
29
src/Util/Equality.js
Normal file
29
src/Util/Equality.js
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
The Equality Class is just used to show
|
||||
that a Class has an ID that can be used to
|
||||
check for equality.
|
||||
|
||||
Never use == or === when comparing
|
||||
objects in discord.js, they will be different
|
||||
instances sometimes.
|
||||
|
||||
Instead, use objectThatExtendsEquality.equals()
|
||||
*/
|
||||
class Equality{
|
||||
constructor(){
|
||||
|
||||
}
|
||||
|
||||
get eqDiscriminator(){
|
||||
return "id";
|
||||
}
|
||||
|
||||
equals(object){
|
||||
if(object && object[this.eqDiscriminator] == this[this.eqDiscriminator]){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Equality;
|
||||
Reference in New Issue
Block a user