mirror of
https://github.com/musix-org/musix-oss
synced 2024-12-23 16:13:18 +00:00
389 lines
63 KiB
JavaScript
389 lines
63 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
/**
|
|
* A Map with additional utility methods. This is used throughout discord.js rather than Arrays for anything that has
|
|
* an ID, for significantly improved performance and ease-of-use.
|
|
* @extends {Map}
|
|
* @property {number} size - The amount of elements in this collection.
|
|
*/
|
|
class Collection extends Map {
|
|
constructor(entries) {
|
|
super(entries);
|
|
/**
|
|
* Cached array for the `array()` method - will be reset to `null` whenever `set()` or `delete()` are called
|
|
* @name Collection#_array
|
|
* @type {?Array}
|
|
* @private
|
|
*/
|
|
Object.defineProperty(this, '_array', { value: null, writable: true, configurable: true });
|
|
/**
|
|
* Cached array for the `keyArray()` method - will be reset to `null` whenever `set()` or `delete()` are called
|
|
* @name Collection#_keyArray
|
|
* @type {?Array}
|
|
* @private
|
|
*/
|
|
Object.defineProperty(this, '_keyArray', { value: null, writable: true, configurable: true });
|
|
}
|
|
/**
|
|
* Identical to [Map.get()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/get).
|
|
* Gets an element with the specified key, and returns its value, or `undefined` if the element does not exist.
|
|
* @param {*} key - The key to get from this collection
|
|
* @returns {* | undefined}
|
|
*/
|
|
get(key) {
|
|
return super.get(key);
|
|
}
|
|
/**
|
|
* Identical to [Map.set()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/set).
|
|
* Sets a new element in the collection with the specified key and value.
|
|
* @param {*} key - The key of the element to add
|
|
* @param {*} value - The value of the element to add
|
|
* @returns {Collection}
|
|
*/
|
|
set(key, value) {
|
|
this._array = null;
|
|
this._keyArray = null;
|
|
return super.set(key, value);
|
|
}
|
|
/**
|
|
* Identical to [Map.has()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/has).
|
|
* Checks if an element exists in the collection.
|
|
* @param {*} key - The key of the element to check for
|
|
* @returns {boolean} `true` if the element exists, `false` if it does not exist.
|
|
*/
|
|
has(key) {
|
|
return super.has(key);
|
|
}
|
|
/**
|
|
* Identical to [Map.delete()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/delete).
|
|
* Deletes an element from the collection.
|
|
* @param {*} key - The key to delete from the collection
|
|
* @returns {boolean} `true` if the element was removed, `false` if the element does not exist.
|
|
*/
|
|
delete(key) {
|
|
this._array = null;
|
|
this._keyArray = null;
|
|
return super.delete(key);
|
|
}
|
|
/**
|
|
* Identical to [Map.clear()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/clear).
|
|
* Removes all elements from the collection.
|
|
* @returns {undefined}
|
|
*/
|
|
clear() {
|
|
return super.clear();
|
|
}
|
|
/**
|
|
* Creates an ordered array of the values of this collection, and caches it internally. The array will only be
|
|
* reconstructed if an item is added to or removed from the collection, or if you change the length of the array
|
|
* itself. If you don't want this caching behavior, use `[...collection.values()]` or
|
|
* `Array.from(collection.values())` instead.
|
|
* @returns {Array}
|
|
*/
|
|
array() {
|
|
if (!this._array || this._array.length !== this.size)
|
|
this._array = [...this.values()];
|
|
return this._array;
|
|
}
|
|
/**
|
|
* Creates an ordered array of the keys of this collection, and caches it internally. The array will only be
|
|
* reconstructed if an item is added to or removed from the collection, or if you change the length of the array
|
|
* itself. If you don't want this caching behavior, use `[...collection.keys()]` or
|
|
* `Array.from(collection.keys())` instead.
|
|
* @returns {Array}
|
|
*/
|
|
keyArray() {
|
|
if (!this._keyArray || this._keyArray.length !== this.size)
|
|
this._keyArray = [...this.keys()];
|
|
return this._keyArray;
|
|
}
|
|
first(amount) {
|
|
if (typeof amount === 'undefined')
|
|
return this.values().next().value;
|
|
if (amount < 0)
|
|
return this.last(amount * -1);
|
|
amount = Math.min(this.size, amount);
|
|
const iter = this.values();
|
|
return Array.from({ length: amount }, () => iter.next().value);
|
|
}
|
|
firstKey(amount) {
|
|
if (typeof amount === 'undefined')
|
|
return this.keys().next().value;
|
|
if (amount < 0)
|
|
return this.lastKey(amount * -1);
|
|
amount = Math.min(this.size, amount);
|
|
const iter = this.keys();
|
|
return Array.from({ length: amount }, () => iter.next().value);
|
|
}
|
|
last(amount) {
|
|
const arr = this.array();
|
|
if (typeof amount === 'undefined')
|
|
return arr[arr.length - 1];
|
|
if (amount < 0)
|
|
return this.first(amount * -1);
|
|
if (!amount)
|
|
return [];
|
|
return arr.slice(-amount);
|
|
}
|
|
lastKey(amount) {
|
|
const arr = this.keyArray();
|
|
if (typeof amount === 'undefined')
|
|
return arr[arr.length - 1];
|
|
if (amount < 0)
|
|
return this.firstKey(amount * -1);
|
|
if (!amount)
|
|
return [];
|
|
return arr.slice(-amount);
|
|
}
|
|
random(amount) {
|
|
let arr = this.array();
|
|
if (typeof amount === 'undefined')
|
|
return arr[Math.floor(Math.random() * arr.length)];
|
|
if (arr.length === 0 || !amount)
|
|
return [];
|
|
arr = arr.slice();
|
|
return Array.from({ length: amount }, () => arr.splice(Math.floor(Math.random() * arr.length), 1)[0]);
|
|
}
|
|
randomKey(amount) {
|
|
let arr = this.keyArray();
|
|
if (typeof amount === 'undefined')
|
|
return arr[Math.floor(Math.random() * arr.length)];
|
|
if (arr.length === 0 || !amount)
|
|
return [];
|
|
arr = arr.slice();
|
|
return Array.from({ length: amount }, () => arr.splice(Math.floor(Math.random() * arr.length), 1)[0]);
|
|
}
|
|
find(fn, thisArg) {
|
|
if (typeof thisArg !== 'undefined')
|
|
fn = fn.bind(thisArg);
|
|
for (const [key, val] of this) {
|
|
if (fn(val, key, this))
|
|
return val;
|
|
}
|
|
return undefined;
|
|
}
|
|
findKey(fn, thisArg) {
|
|
if (typeof thisArg !== 'undefined')
|
|
fn = fn.bind(thisArg);
|
|
for (const [key, val] of this) {
|
|
if (fn(val, key, this))
|
|
return key;
|
|
}
|
|
return undefined;
|
|
}
|
|
sweep(fn, thisArg) {
|
|
if (typeof thisArg !== 'undefined')
|
|
fn = fn.bind(thisArg);
|
|
const previousSize = this.size;
|
|
for (const [key, val] of this) {
|
|
if (fn(val, key, this))
|
|
this.delete(key);
|
|
}
|
|
return previousSize - this.size;
|
|
}
|
|
filter(fn, thisArg) {
|
|
if (typeof thisArg !== 'undefined')
|
|
fn = fn.bind(thisArg);
|
|
const results = new this.constructor[Symbol.species]();
|
|
for (const [key, val] of this) {
|
|
if (fn(val, key, this))
|
|
results.set(key, val);
|
|
}
|
|
return results;
|
|
}
|
|
partition(fn, thisArg) {
|
|
if (typeof thisArg !== 'undefined')
|
|
fn = fn.bind(thisArg);
|
|
// TODO: consider removing the <K, V> from the constructors after TS 3.7.0 is released, as it infers it
|
|
const results = [new this.constructor[Symbol.species](), new this.constructor[Symbol.species]()];
|
|
for (const [key, val] of this) {
|
|
if (fn(val, key, this)) {
|
|
results[0].set(key, val);
|
|
}
|
|
else {
|
|
results[1].set(key, val);
|
|
}
|
|
}
|
|
return results;
|
|
}
|
|
flatMap(fn, thisArg) {
|
|
const collections = this.map(fn, thisArg);
|
|
return new this.constructor[Symbol.species]().concat(...collections);
|
|
}
|
|
map(fn, thisArg) {
|
|
if (typeof thisArg !== 'undefined')
|
|
fn = fn.bind(thisArg);
|
|
const iter = this.entries();
|
|
return Array.from({ length: this.size }, () => {
|
|
const [key, value] = iter.next().value;
|
|
return fn(value, key, this);
|
|
});
|
|
}
|
|
mapValues(fn, thisArg) {
|
|
if (typeof thisArg !== 'undefined')
|
|
fn = fn.bind(thisArg);
|
|
const coll = new this.constructor[Symbol.species]();
|
|
for (const [key, val] of this)
|
|
coll.set(key, fn(val, key, this));
|
|
return coll;
|
|
}
|
|
some(fn, thisArg) {
|
|
if (typeof thisArg !== 'undefined')
|
|
fn = fn.bind(thisArg);
|
|
for (const [key, val] of this) {
|
|
if (fn(val, key, this))
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
every(fn, thisArg) {
|
|
if (typeof thisArg !== 'undefined')
|
|
fn = fn.bind(thisArg);
|
|
for (const [key, val] of this) {
|
|
if (!fn(val, key, this))
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
/**
|
|
* Applies a function to produce a single value. Identical in behavior to
|
|
* [Array.reduce()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce).
|
|
* @param {Function} fn Function used to reduce, taking four arguments; `accumulator`, `currentValue`, `currentKey`,
|
|
* and `collection`
|
|
* @param {*} [initialValue] Starting value for the accumulator
|
|
* @returns {*}
|
|
* @example collection.reduce((acc, guild) => acc + guild.memberCount, 0);
|
|
*/
|
|
reduce(fn, initialValue) {
|
|
let accumulator;
|
|
if (typeof initialValue !== 'undefined') {
|
|
accumulator = initialValue;
|
|
for (const [key, val] of this)
|
|
accumulator = fn(accumulator, val, key, this);
|
|
return accumulator;
|
|
}
|
|
let first = true;
|
|
for (const [key, val] of this) {
|
|
if (first) {
|
|
accumulator = val;
|
|
first = false;
|
|
continue;
|
|
}
|
|
accumulator = fn(accumulator, val, key, this);
|
|
}
|
|
// No items iterated.
|
|
if (first) {
|
|
throw new TypeError('Reduce of empty collection with no initial value');
|
|
}
|
|
return accumulator;
|
|
}
|
|
each(fn, thisArg) {
|
|
this.forEach(fn, thisArg);
|
|
return this;
|
|
}
|
|
tap(fn, thisArg) {
|
|
if (typeof thisArg !== 'undefined')
|
|
fn = fn.bind(thisArg);
|
|
fn(this);
|
|
return this;
|
|
}
|
|
/**
|
|
* Creates an identical shallow copy of this collection.
|
|
* @returns {Collection}
|
|
* @example const newColl = someColl.clone();
|
|
*/
|
|
clone() {
|
|
return new this.constructor[Symbol.species](this);
|
|
}
|
|
/**
|
|
* Combines this collection with others into a new collection. None of the source collections are modified.
|
|
* @param {...Collection} collections Collections to merge
|
|
* @returns {Collection}
|
|
* @example const newColl = someColl.concat(someOtherColl, anotherColl, ohBoyAColl);
|
|
*/
|
|
concat(...collections) {
|
|
const newColl = this.clone();
|
|
for (const coll of collections) {
|
|
for (const [key, val] of coll)
|
|
newColl.set(key, val);
|
|
}
|
|
return newColl;
|
|
}
|
|
/**
|
|
* Checks if this collection shares identical items with another.
|
|
* This is different to checking for equality using equal-signs, because
|
|
* the collections may be different objects, but contain the same data.
|
|
* @param {Collection} collection Collection to compare with
|
|
* @returns {boolean} Whether the collections have identical contents
|
|
*/
|
|
equals(collection) {
|
|
if (!collection)
|
|
return false;
|
|
if (this === collection)
|
|
return true;
|
|
if (this.size !== collection.size)
|
|
return false;
|
|
for (const [key, value] of this) {
|
|
if (!collection.has(key) || value !== collection.get(key)) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
/**
|
|
* The sort method sorts the items of a collection in place and returns it.
|
|
* The sort is not necessarily stable. The default sort order is according to string Unicode code points.
|
|
* @param {Function} [compareFunction] Specifies a function that defines the sort order.
|
|
* If omitted, the collection is sorted according to each character's Unicode code point value,
|
|
* according to the string conversion of each element.
|
|
* @returns {Collection}
|
|
* @example collection.sort((userA, userB) => userA.createdTimestamp - userB.createdTimestamp);
|
|
*/
|
|
sort(compareFunction = (x, y) => Number(x > y) || Number(x === y) - 1) {
|
|
const entries = [...this.entries()];
|
|
entries.sort((a, b) => compareFunction(a[1], b[1], a[0], b[0]));
|
|
// Perform clean-up
|
|
super.clear();
|
|
this._array = null;
|
|
this._keyArray = null;
|
|
// Set the new entries
|
|
for (const [k, v] of entries) {
|
|
super.set(k, v);
|
|
}
|
|
return this;
|
|
}
|
|
/**
|
|
* The intersect method returns a new structure containing items where the keys are present in both original structures.
|
|
* @param {Collection} other The other Collection to filter against
|
|
* @returns {Collection}
|
|
*/
|
|
intersect(other) {
|
|
return other.filter((_, k) => this.has(k));
|
|
}
|
|
/**
|
|
* The difference method returns a new structure containing items where the key is present in one of the original structures but not the other.
|
|
* @param {Collection} other The other Collection to filter against
|
|
* @returns {Collection}
|
|
*/
|
|
difference(other) {
|
|
return other.filter((_, k) => !this.has(k)).concat(this.filter((_, k) => !other.has(k)));
|
|
}
|
|
/**
|
|
* The sorted method sorts the items of a collection and returns it.
|
|
* The sort is not necessarily stable. The default sort order is according to string Unicode code points.
|
|
* @param {Function} [compareFunction] Specifies a function that defines the sort order.
|
|
* If omitted, the collection is sorted according to each character's Unicode code point value,
|
|
* according to the string conversion of each element.
|
|
* @returns {Collection}
|
|
* @example collection.sorted((userA, userB) => userA.createdTimestamp - userB.createdTimestamp);
|
|
*/
|
|
sorted(compareFunction = (x, y) => Number(x > y) || Number(x === y) - 1) {
|
|
return new this.constructor[Symbol.species]([...this.entries()])
|
|
.sort((av, bv, ak, bk) => compareFunction(av, bv, ak, bk));
|
|
}
|
|
}
|
|
exports.Collection = Collection;
|
|
Collection.default = Collection;
|
|
exports.default = Collection;
|
|
module.exports = Collection;
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiLyIsInNvdXJjZXMiOlsiaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFRQTs7Ozs7R0FLRztBQUNILE1BQU0sVUFBaUIsU0FBUSxHQUFTO0lBTXZDLFlBQW1CLE9BQStDO1FBQ2pFLEtBQUssQ0FBQyxPQUFPLENBQUMsQ0FBQztRQUVmOzs7OztXQUtHO1FBQ0gsTUFBTSxDQUFDLGNBQWMsQ0FBQyxJQUFJLEVBQUUsUUFBUSxFQUFFLEVBQUUsS0FBSyxFQUFFLElBQUksRUFBRSxRQUFRLEVBQUUsSUFBSSxFQUFFLFlBQVksRUFBRSxJQUFJLEVBQUUsQ0FBQyxDQUFDO1FBRTNGOzs7OztXQUtHO1FBQ0gsTUFBTSxDQUFDLGNBQWMsQ0FBQyxJQUFJLEVBQUUsV0FBVyxFQUFFLEVBQUUsS0FBSyxFQUFFLElBQUksRUFBRSxRQUFRLEVBQUUsSUFBSSxFQUFFLFlBQVksRUFBRSxJQUFJLEVBQUUsQ0FBQyxDQUFDO0lBQy9GLENBQUM7SUFFRDs7Ozs7T0FLRztJQUNJLEdBQUcsQ0FBQy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