mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 11:33:30 +01:00
Equality docs
This commit is contained in:
20
docs/docs_equality.rst
Normal file
20
docs/docs_equality.rst
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
.. include:: ./vars.rst
|
||||||
|
|
||||||
|
Equality
|
||||||
|
========
|
||||||
|
|
||||||
|
The Equality class is used to see if two objects are equal, based on ``object_1.id === object_2.id``.
|
||||||
|
|
||||||
|
If any class in Discord extends equality, it means you should never the default equality operands (``==`` & ``===``) as they could potentially be different instances and therefore appear not to be equal. Instead, use ``equalityObject.equals()`` as shown below.
|
||||||
|
|
||||||
|
Functions
|
||||||
|
---------
|
||||||
|
|
||||||
|
--------
|
||||||
|
|
||||||
|
equals(object)
|
||||||
|
~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Returns true if the specified object is the same as this one.
|
||||||
|
|
||||||
|
- **object** - Any `object` with an ``id`` property.
|
||||||
@@ -37,12 +37,14 @@ Contents:
|
|||||||
docs_server
|
docs_server
|
||||||
docs_user
|
docs_user
|
||||||
docs_message
|
docs_message
|
||||||
|
docs_invite
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 2
|
:maxdepth: 2
|
||||||
:caption: Util Documentation
|
:caption: Util Documentation
|
||||||
|
|
||||||
docs_cache
|
docs_cache
|
||||||
|
docs_equality
|
||||||
|
|
||||||
|
|
||||||
Indices and tables
|
Indices and tables
|
||||||
|
|||||||
@@ -8,5 +8,7 @@
|
|||||||
.. _VoiceChannel : ./docs_voicechannel.html
|
.. _VoiceChannel : ./docs_voicechannel.html
|
||||||
.. _PMChannel : ./docs_pmchannel.html
|
.. _PMChannel : ./docs_pmchannel.html
|
||||||
.. _Message : ./docs_message.html
|
.. _Message : ./docs_message.html
|
||||||
|
.. _Invite : ./docs_invite.html
|
||||||
|
.. _Equality : ./docs_equality.html
|
||||||
.. _Promises : https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
.. _Promises : https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
||||||
.. _EventEmitter : https://nodejs.org/api/events.html#events_class_events_eventemitter
|
.. _EventEmitter : https://nodejs.org/api/events.html#events_class_events_eventemitter
|
||||||
Reference in New Issue
Block a user