📦Collection

Prototypes to Collection

Converting iterable keys to array

// discord.js
Array.from(<Collection>.keys());

// djs-protofy
<Collection>.keysToArray(); // Array

Converting iterable values to array

// discord.js
Array.from(<Collection>.values());

// djs-protofy
<Collection>.valuesToArray(); // Array
// Code inside <Collection>.toJSON

// discord.js
toJSON() {
  return [...this.values()]; // Bruh... Spread Operator
}

// djs-protofy
toJSON() {
  return Array.from(this.values()); // Yes, it's really faster
}

Last updated