mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-19 13:03:31 +01:00
Slightly improve some Collection docs
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -107,9 +107,9 @@ class Collection extends Map {
|
|||||||
* @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 {*}
|
||||||
* @example
|
* @example
|
||||||
* collection.find('id', '123123...');
|
* collection.find('username', 'Bob');
|
||||||
* @example
|
* @example
|
||||||
* collection.find(val => val.id === '123123...');
|
* collection.find(val => val.username === 'Bob');
|
||||||
*/
|
*/
|
||||||
find(propOrFn, value) {
|
find(propOrFn, value) {
|
||||||
if (typeof propOrFn === 'string') {
|
if (typeof propOrFn === 'string') {
|
||||||
@@ -137,9 +137,9 @@ class Collection extends Map {
|
|||||||
* @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 {*}
|
||||||
* @example
|
* @example
|
||||||
* collection.find('id', '123123...');
|
* collection.findKey('username', 'Bob');
|
||||||
* @example
|
* @example
|
||||||
* collection.find(val => val.id === '123123...');
|
* collection.findKey(val => val.username === 'Bob');
|
||||||
*/
|
*/
|
||||||
/* eslint-enable max-len */
|
/* eslint-enable max-len */
|
||||||
findKey(propOrFn, value) {
|
findKey(propOrFn, value) {
|
||||||
@@ -165,7 +165,7 @@ class Collection extends Map {
|
|||||||
* @param {*} value The expected value
|
* @param {*} value The expected value
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
* @example
|
* @example
|
||||||
* if (collection.exists('id', '123123...')) {
|
* if (collection.exists('username', 'Bob')) {
|
||||||
* console.log('user here!');
|
* console.log('user here!');
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
@@ -201,9 +201,7 @@ class Collection extends Map {
|
|||||||
if (thisArg) fn = fn.bind(thisArg);
|
if (thisArg) fn = fn.bind(thisArg);
|
||||||
const arr = new Array(this.size);
|
const arr = new Array(this.size);
|
||||||
let i = 0;
|
let i = 0;
|
||||||
for (const [key, val] of this) {
|
for (const [key, val] of this) arr[i++] = fn(val, key, this);
|
||||||
arr[i++] = fn(val, key, this);
|
|
||||||
}
|
|
||||||
return arr;
|
return arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user