Add warnings for Collection.find/exists

This commit is contained in:
Schuyler Cebulskie
2016-10-30 22:22:16 -04:00
parent 73261646fc
commit d7e1e1c0c9
2 changed files with 7 additions and 3 deletions

View File

@@ -340,7 +340,7 @@ class Client extends EventEmitter {
* Sets a timeout that will be automatically cancelled if the client is destroyed. * Sets a timeout that will be automatically cancelled if the client is destroyed.
* @param {function} fn Function to execute * @param {function} fn Function to execute
* @param {number} delay Time to wait before executing (in milliseconds) * @param {number} delay Time to wait before executing (in milliseconds)
* @param {args} args Arguments for the function (not an array, but an infinite argument) * @param {args} args Arguments for the function (infinite/rest argument, not an array)
* @returns {Timeout} * @returns {Timeout}
*/ */
setTimeout(fn, delay, ...args) { setTimeout(fn, delay, ...args) {
@@ -365,7 +365,7 @@ class Client extends EventEmitter {
* Sets an interval that will be automatically cancelled if the client is destroyed. * Sets an interval that will be automatically cancelled if the client is destroyed.
* @param {function} fn Function to execute * @param {function} fn Function to execute
* @param {number} delay Time to wait before executing (in milliseconds) * @param {number} delay Time to wait before executing (in milliseconds)
* @param {args} args Arguments for the function (not an array, but an infinite argument) * @param {args} args Arguments for the function (infinite/rest argument, not an array)
* @returns {Timeout} * @returns {Timeout}
*/ */
setInterval(fn, delay, ...args) { setInterval(fn, delay, ...args) {

View File

@@ -125,6 +125,8 @@ class Collection extends Map {
* Returns a single item where `item[prop] === value`, or the given function returns `true`. * Returns a single item where `item[prop] === value`, or the given function returns `true`.
* In the latter case, this is identical to * In the latter case, this is identical to
* [Array.find()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find). * [Array.find()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find).
* <warn>Do not use this to obtain an item by its ID. Instead, use `collection.get(id)`. See
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/get) for details.</warn>
* @param {string|function} propOrFn The property to test against, or the function to test with * @param {string|function} propOrFn The property to test against, or the function to test with
* @param {*} [value] The expected value - only applicable and required if using a property for the first argument * @param {*} [value] The expected value - only applicable and required if using a property for the first argument
* @returns {*} * @returns {*}
@@ -183,6 +185,8 @@ class Collection extends Map {
/** /**
* Returns true if the collection has an item where `item[prop] === value` * Returns true if the collection has an item where `item[prop] === value`
* <warn>Do not use this to check for an item by its ID. Instead, use `collection.has(id)`. See
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/has) for details.</warn>
* @param {string} prop The property to test against * @param {string} prop The property to test against
* @param {*} value The expected value * @param {*} value The expected value
* @returns {boolean} * @returns {boolean}
@@ -288,7 +292,7 @@ class Collection extends Map {
/** /**
* Combines this collection with others into a new collection. None of the source collections are modified. * Combines this collection with others into a new collection. None of the source collections are modified.
* @param {Collection} collections Collections to merge * @param {Collection} collections Collections to merge (infinite/rest argument, not an array)
* @returns {Collection} * @returns {Collection}
* @example const newColl = someColl.concat(someOtherColl, anotherColl, ohBoyAColl); * @example const newColl = someColl.concat(someOtherColl, anotherColl, ohBoyAColl);
*/ */