mirror of
https://github.com/danbulant/discord.js
synced 2026-07-07 20:20:55 +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
|
* @returns {*|Array<*>} The single value if `count` is undefined, or an array of values of `count` length
|
||||||
*/
|
*/
|
||||||
first(count) {
|
first(count) {
|
||||||
if (count === undefined) return this.values().next().value;
|
if (typeof count === 'undefined') return this.values().next().value;
|
||||||
if (typeof count !== 'number') throw new TypeError('The count must be a number.');
|
|
||||||
if (!Number.isInteger(count) || count < 1) throw new RangeError('The count must be an integer greater than 0.');
|
if (!Number.isInteger(count) || count < 1) throw new RangeError('The count must be an integer greater than 0.');
|
||||||
count = Math.min(this.size, count);
|
count = Math.min(this.size, count);
|
||||||
const arr = new Array(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
|
* @returns {*|Array<*>} The single key if `count` is undefined, or an array of keys of `count` length
|
||||||
*/
|
*/
|
||||||
firstKey(count) {
|
firstKey(count) {
|
||||||
if (count === undefined) return this.keys().next().value;
|
if (typeof count === 'undefined') return this.keys().next().value;
|
||||||
if (typeof count !== 'number') throw new TypeError('The count must be a number.');
|
|
||||||
if (!Number.isInteger(count) || count < 1) throw new RangeError('The count must be an integer greater than 0.');
|
if (!Number.isInteger(count) || count < 1) throw new RangeError('The count must be an integer greater than 0.');
|
||||||
count = Math.min(this.size, count);
|
count = Math.min(this.size, count);
|
||||||
const arr = new Array(count);
|
const arr = new Array(count);
|
||||||
|
|
@ -921,8 +919,7 @@ class Collection extends Map {
|
||||||
*/
|
*/
|
||||||
last(count) {
|
last(count) {
|
||||||
const arr = this.array();
|
const arr = this.array();
|
||||||
if (count === undefined) return arr[arr.length - 1];
|
if (typeof count === 'undefined') return arr[arr.length - 1];
|
||||||
if (typeof count !== 'number') throw new TypeError('The count must be a number.');
|
|
||||||
if (!Number.isInteger(count) || count < 1) throw new RangeError('The count must be an integer greater than 0.');
|
if (!Number.isInteger(count) || count < 1) throw new RangeError('The count must be an integer greater than 0.');
|
||||||
return arr.slice(-count);
|
return arr.slice(-count);
|
||||||
}
|
}
|
||||||
|
|
@ -935,8 +932,7 @@ class Collection extends Map {
|
||||||
*/
|
*/
|
||||||
lastKey(count) {
|
lastKey(count) {
|
||||||
const arr = this.keyArray();
|
const arr = this.keyArray();
|
||||||
if (count === undefined) return arr[arr.length - 1];
|
if (typeof count === 'undefined') return arr[arr.length - 1];
|
||||||
if (typeof count !== 'number') throw new TypeError('The count must be a number.');
|
|
||||||
if (!Number.isInteger(count) || count < 1) throw new RangeError('The count must be an integer greater than 0.');
|
if (!Number.isInteger(count) || count < 1) throw new RangeError('The count must be an integer greater than 0.');
|
||||||
return arr.slice(-count);
|
return arr.slice(-count);
|
||||||
}
|
}
|
||||||
|
|
@ -949,8 +945,7 @@ class Collection extends Map {
|
||||||
*/
|
*/
|
||||||
random(count) {
|
random(count) {
|
||||||
let arr = this.array();
|
let arr = this.array();
|
||||||
if (count === undefined) return arr[Math.floor(Math.random() * arr.length)];
|
if (typeof count === 'undefined') return arr[Math.floor(Math.random() * arr.length)];
|
||||||
if (typeof count !== 'number') throw new TypeError('The count must be a number.');
|
|
||||||
if (!Number.isInteger(count) || count < 1) throw new RangeError('The count must be an integer greater than 0.');
|
if (!Number.isInteger(count) || count < 1) throw new RangeError('The count must be an integer greater than 0.');
|
||||||
if (arr.length === 0) return [];
|
if (arr.length === 0) return [];
|
||||||
const rand = new Array(count);
|
const rand = new Array(count);
|
||||||
|
|
@ -967,8 +962,7 @@ class Collection extends Map {
|
||||||
*/
|
*/
|
||||||
randomKey(count) {
|
randomKey(count) {
|
||||||
let arr = this.keyArray();
|
let arr = this.keyArray();
|
||||||
if (count === undefined) return arr[Math.floor(Math.random() * arr.length)];
|
if (typeof count === 'undefined') return arr[Math.floor(Math.random() * arr.length)];
|
||||||
if (typeof count !== 'number') throw new TypeError('The count must be a number.');
|
|
||||||
if (!Number.isInteger(count) || count < 1) throw new RangeError('The count must be an integer greater than 0.');
|
if (!Number.isInteger(count) || count < 1) throw new RangeError('The count must be an integer greater than 0.');
|
||||||
if (arr.length === 0) return [];
|
if (arr.length === 0) return [];
|
||||||
const rand = new Array(count);
|
const rand = new Array(count);
|
||||||
|
|
|
||||||
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