mirror of
https://github.com/danbulant/discord.js
synced 2026-06-19 22:51:32 +00:00
Webpack build for branch master: 3a503ef56e
This commit is contained in:
parent
62db07359a
commit
cf88df21df
2 changed files with 8 additions and 14 deletions
|
|
@ -887,8 +887,7 @@ class Collection extends Map {
|
|||
* @returns {*|Array<*>} The single value if `count` is undefined, or an array of values of `count` length
|
||||
*/
|
||||
first(count) {
|
||||
if (count === undefined) return this.values().next().value;
|
||||
if (typeof count !== 'number') throw new TypeError('The count must be a number.');
|
||||
if (typeof count === 'undefined') return this.values().next().value;
|
||||
if (!Number.isInteger(count) || count < 1) throw new RangeError('The count must be an integer greater than 0.');
|
||||
count = Math.min(this.size, count);
|
||||
const arr = new Array(count);
|
||||
|
|
@ -903,8 +902,7 @@ class Collection extends Map {
|
|||
* @returns {*|Array<*>} The single key if `count` is undefined, or an array of keys of `count` length
|
||||
*/
|
||||
firstKey(count) {
|
||||
if (count === undefined) return this.keys().next().value;
|
||||
if (typeof count !== 'number') throw new TypeError('The count must be a number.');
|
||||
if (typeof count === 'undefined') return this.keys().next().value;
|
||||
if (!Number.isInteger(count) || count < 1) throw new RangeError('The count must be an integer greater than 0.');
|
||||
count = Math.min(this.size, count);
|
||||
const arr = new Array(count);
|
||||
|
|
@ -921,8 +919,7 @@ class Collection extends Map {
|
|||
*/
|
||||
last(count) {
|
||||
const arr = this.array();
|
||||
if (count === undefined) return arr[arr.length - 1];
|
||||
if (typeof count !== 'number') throw new TypeError('The count must be a number.');
|
||||
if (typeof count === 'undefined') return arr[arr.length - 1];
|
||||
if (!Number.isInteger(count) || count < 1) throw new RangeError('The count must be an integer greater than 0.');
|
||||
return arr.slice(-count);
|
||||
}
|
||||
|
|
@ -935,8 +932,7 @@ class Collection extends Map {
|
|||
*/
|
||||
lastKey(count) {
|
||||
const arr = this.keyArray();
|
||||
if (count === undefined) return arr[arr.length - 1];
|
||||
if (typeof count !== 'number') throw new TypeError('The count must be a number.');
|
||||
if (typeof count === 'undefined') return arr[arr.length - 1];
|
||||
if (!Number.isInteger(count) || count < 1) throw new RangeError('The count must be an integer greater than 0.');
|
||||
return arr.slice(-count);
|
||||
}
|
||||
|
|
@ -949,8 +945,7 @@ class Collection extends Map {
|
|||
*/
|
||||
random(count) {
|
||||
let arr = this.array();
|
||||
if (count === undefined) return arr[Math.floor(Math.random() * arr.length)];
|
||||
if (typeof count !== 'number') throw new TypeError('The count must be a number.');
|
||||
if (typeof count === 'undefined') return arr[Math.floor(Math.random() * arr.length)];
|
||||
if (!Number.isInteger(count) || count < 1) throw new RangeError('The count must be an integer greater than 0.');
|
||||
if (arr.length === 0) return [];
|
||||
const rand = new Array(count);
|
||||
|
|
@ -967,8 +962,7 @@ class Collection extends Map {
|
|||
*/
|
||||
randomKey(count) {
|
||||
let arr = this.keyArray();
|
||||
if (count === undefined) return arr[Math.floor(Math.random() * arr.length)];
|
||||
if (typeof count !== 'number') throw new TypeError('The count must be a number.');
|
||||
if (typeof count === 'undefined') return arr[Math.floor(Math.random() * arr.length)];
|
||||
if (!Number.isInteger(count) || count < 1) throw new RangeError('The count must be an integer greater than 0.');
|
||||
if (arr.length === 0) return [];
|
||||
const rand = new Array(count);
|
||||
|
|
@ -1071,7 +1065,7 @@ class Collection extends Map {
|
|||
* if (collection.exists('username', 'Bob')) {
|
||||
* console.log('user here!');
|
||||
* }
|
||||
* @example
|
||||
* @example
|
||||
* if (collection.exists(user => user.username === 'Bob')) {
|
||||
* console.log('user here!');
|
||||
* }
|
||||
|
|
|
|||
2
discord.master.min.js
vendored
2
discord.master.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue