Files
discord.js/src/util/Collection.js
1Computer1 dad0cd8e81 feat: external collection package (#2934)
* Use external collection package

* Complete typings

* Document properly base collection class

* Add clone since sort is now in-place

* Update for latest changes to package

* Fix whitespace

* Update docs link

* Oops

* Update Collection.js

* Update index.d.ts
2019-09-10 17:44:47 +02:00

23 lines
601 B
JavaScript

'use strict';
const BaseCollection = require('@discordjs/collection');
const Util = require('./Util');
/**
* 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 {BaseCollection}
*/
class Collection extends BaseCollection {
toJSON() {
return this.map(e => typeof e.toJSON === 'function' ? e.toJSON() : Util.flatten(e));
}
}
module.exports = Collection;
/**
* @external BaseCollection
* @see {@link https://discord.js.org/#/docs/collection/}
*/