mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-14 10:33:30 +01:00
docs(collection): Minor article additions (#9868)
docs(collection): add articles
This commit is contained in:
@@ -221,8 +221,8 @@ export class Collection<K, V> extends Map<K, V> {
|
|||||||
* should use the `get` method. See
|
* should use the `get` method. See
|
||||||
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/get | MDN} for details.
|
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/get | MDN} for details.
|
||||||
*
|
*
|
||||||
* @param fn - The function to test with (should return boolean)
|
* @param fn - The function to test with (should return a boolean)
|
||||||
* @param thisArg - Value to use as `this` when executing function
|
* @param thisArg - Value to use as `this` when executing the function
|
||||||
* @example
|
* @example
|
||||||
* ```ts
|
* ```ts
|
||||||
* collection.find(user => user.username === 'Bob');
|
* collection.find(user => user.username === 'Bob');
|
||||||
@@ -250,8 +250,8 @@ export class Collection<K, V> extends Map<K, V> {
|
|||||||
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex | Array.findIndex()},
|
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex | Array.findIndex()},
|
||||||
* but returns the key rather than the positional index.
|
* but returns the key rather than the positional index.
|
||||||
*
|
*
|
||||||
* @param fn - The function to test with (should return boolean)
|
* @param fn - The function to test with (should return a boolean)
|
||||||
* @param thisArg - Value to use as `this` when executing function
|
* @param thisArg - Value to use as `this` when executing the function
|
||||||
* @example
|
* @example
|
||||||
* ```ts
|
* ```ts
|
||||||
* collection.findKey(user => user.username === 'Bob');
|
* collection.findKey(user => user.username === 'Bob');
|
||||||
@@ -278,7 +278,7 @@ export class Collection<K, V> extends Map<K, V> {
|
|||||||
* Removes items that satisfy the provided filter function.
|
* Removes items that satisfy the provided filter function.
|
||||||
*
|
*
|
||||||
* @param fn - Function used to test (should return a boolean)
|
* @param fn - Function used to test (should return a boolean)
|
||||||
* @param thisArg - Value to use as `this` when executing function
|
* @param thisArg - Value to use as `this` when executing the function
|
||||||
* @returns The number of removed entries
|
* @returns The number of removed entries
|
||||||
*/
|
*/
|
||||||
public sweep(fn: (value: V, key: K, collection: this) => unknown): number;
|
public sweep(fn: (value: V, key: K, collection: this) => unknown): number;
|
||||||
@@ -299,8 +299,8 @@ export class Collection<K, V> extends Map<K, V> {
|
|||||||
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter | Array.filter()},
|
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter | Array.filter()},
|
||||||
* but returns a Collection instead of an Array.
|
* but returns a Collection instead of an Array.
|
||||||
*
|
*
|
||||||
* @param fn - The function to test with (should return boolean)
|
* @param fn - The function to test with (should return a boolean)
|
||||||
* @param thisArg - Value to use as `this` when executing function
|
* @param thisArg - Value to use as `this` when executing the function
|
||||||
* @example
|
* @example
|
||||||
* ```ts
|
* ```ts
|
||||||
* collection.filter(user => user.username === 'Bob');
|
* collection.filter(user => user.username === 'Bob');
|
||||||
@@ -334,7 +334,7 @@ export class Collection<K, V> extends Map<K, V> {
|
|||||||
* contains the items that passed and the second contains the items that failed.
|
* contains the items that passed and the second contains the items that failed.
|
||||||
*
|
*
|
||||||
* @param fn - Function used to test (should return a boolean)
|
* @param fn - Function used to test (should return a boolean)
|
||||||
* @param thisArg - Value to use as `this` when executing function
|
* @param thisArg - Value to use as `this` when executing the function
|
||||||
* @example
|
* @example
|
||||||
* ```ts
|
* ```ts
|
||||||
* const [big, small] = collection.partition(guild => guild.memberCount > 250);
|
* const [big, small] = collection.partition(guild => guild.memberCount > 250);
|
||||||
@@ -385,7 +385,7 @@ export class Collection<K, V> extends Map<K, V> {
|
|||||||
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flatMap | Array.flatMap()}.
|
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flatMap | Array.flatMap()}.
|
||||||
*
|
*
|
||||||
* @param fn - Function that produces a new Collection
|
* @param fn - Function that produces a new Collection
|
||||||
* @param thisArg - Value to use as `this` when executing function
|
* @param thisArg - Value to use as `this` when executing the function
|
||||||
* @example
|
* @example
|
||||||
* ```ts
|
* ```ts
|
||||||
* collection.flatMap(guild => guild.members.cache);
|
* collection.flatMap(guild => guild.members.cache);
|
||||||
@@ -407,7 +407,7 @@ export class Collection<K, V> extends Map<K, V> {
|
|||||||
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map | Array.map()}.
|
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map | Array.map()}.
|
||||||
*
|
*
|
||||||
* @param fn - Function that produces an element of the new array, taking three arguments
|
* @param fn - Function that produces an element of the new array, taking three arguments
|
||||||
* @param thisArg - Value to use as `this` when executing function
|
* @param thisArg - Value to use as `this` when executing the function
|
||||||
* @example
|
* @example
|
||||||
* ```ts
|
* ```ts
|
||||||
* collection.map(user => user.tag);
|
* collection.map(user => user.tag);
|
||||||
@@ -430,7 +430,7 @@ export class Collection<K, V> extends Map<K, V> {
|
|||||||
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map | Array.map()}.
|
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map | Array.map()}.
|
||||||
*
|
*
|
||||||
* @param fn - Function that produces an element of the new collection, taking three arguments
|
* @param fn - Function that produces an element of the new collection, taking three arguments
|
||||||
* @param thisArg - Value to use as `this` when executing function
|
* @param thisArg - Value to use as `this` when executing the function
|
||||||
* @example
|
* @example
|
||||||
* ```ts
|
* ```ts
|
||||||
* collection.mapValues(user => user.tag);
|
* collection.mapValues(user => user.tag);
|
||||||
@@ -451,7 +451,7 @@ export class Collection<K, V> extends Map<K, V> {
|
|||||||
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some | Array.some()}.
|
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some | Array.some()}.
|
||||||
*
|
*
|
||||||
* @param fn - Function used to test (should return a boolean)
|
* @param fn - Function used to test (should return a boolean)
|
||||||
* @param thisArg - Value to use as `this` when executing function
|
* @param thisArg - Value to use as `this` when executing the function
|
||||||
* @example
|
* @example
|
||||||
* ```ts
|
* ```ts
|
||||||
* collection.some(user => user.discriminator === '0000');
|
* collection.some(user => user.discriminator === '0000');
|
||||||
@@ -474,7 +474,7 @@ export class Collection<K, V> extends Map<K, V> {
|
|||||||
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every | Array.every()}.
|
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every | Array.every()}.
|
||||||
*
|
*
|
||||||
* @param fn - Function used to test (should return a boolean)
|
* @param fn - Function used to test (should return a boolean)
|
||||||
* @param thisArg - Value to use as `this` when executing function
|
* @param thisArg - Value to use as `this` when executing the function
|
||||||
* @example
|
* @example
|
||||||
* ```ts
|
* ```ts
|
||||||
* collection.every(user => !user.bot);
|
* collection.every(user => !user.bot);
|
||||||
@@ -539,7 +539,7 @@ export class Collection<K, V> extends Map<K, V> {
|
|||||||
* but returns the collection instead of undefined.
|
* but returns the collection instead of undefined.
|
||||||
*
|
*
|
||||||
* @param fn - Function to execute for each element
|
* @param fn - Function to execute for each element
|
||||||
* @param thisArg - Value to use as `this` when executing function
|
* @param thisArg - Value to use as `this` when executing the function
|
||||||
* @example
|
* @example
|
||||||
* ```ts
|
* ```ts
|
||||||
* collection
|
* collection
|
||||||
@@ -565,7 +565,7 @@ export class Collection<K, V> extends Map<K, V> {
|
|||||||
* Runs a function on the collection and returns the collection.
|
* Runs a function on the collection and returns the collection.
|
||||||
*
|
*
|
||||||
* @param fn - Function to execute
|
* @param fn - Function to execute
|
||||||
* @param thisArg - Value to use as `this` when executing function
|
* @param thisArg - Value to use as `this` when executing the function
|
||||||
* @example
|
* @example
|
||||||
* ```ts
|
* ```ts
|
||||||
* collection
|
* collection
|
||||||
|
|||||||
Reference in New Issue
Block a user