Merge remote-tracking branch 'origin/main' into decorators

This commit is contained in:
DjDeveloperr 2020-12-06 12:58:39 +05:30
commit f2e906987c
16 changed files with 69 additions and 69 deletions

View file

@ -8,7 +8,7 @@ import { Collection } from '../utils/collection.ts'
*/ */
export class BaseManager<T, T2> { export class BaseManager<T, T2> {
client: Client client: Client
/** Cache Name or Key used to differentiate caches */ /** Caches Name or Key used to differentiate caches */
cacheName: string cacheName: string
/** Which data type does this cache have */ /** Which data type does this cache have */
DataType: any DataType: any
@ -19,36 +19,36 @@ export class BaseManager<T, T2> {
this.DataType = DataType this.DataType = DataType
} }
/** Get raw value from a cache (payload) */ /** Gets raw value from a cache (payload) */
async _get(key: string): Promise<T | undefined> { async _get(key: string): Promise<T | undefined> {
return this.client.cache.get(this.cacheName, key) return this.client.cache.get(this.cacheName, key)
} }
/** Get a value from Cache */ /** Gets a value from Cache */
async get(key: string): Promise<T2 | undefined> { async get(key: string): Promise<T2 | undefined> {
const raw = await this._get(key) const raw = await this._get(key)
if (raw === undefined) return if (raw === undefined) return
return new this.DataType(this.client, raw) return new this.DataType(this.client, raw)
} }
/** Set a value to Cache */ /** Sets a value to Cache */
async set(key: string, value: T): Promise<any> { async set(key: string, value: T): Promise<any> {
return this.client.cache.set(this.cacheName, key, value) return this.client.cache.set(this.cacheName, key, value)
} }
/** Delete a key from Cache */ /** Deletes a key from Cache */
async delete(key: string): Promise<boolean> { async delete(key: string): Promise<boolean> {
return this.client.cache.delete(this.cacheName, key) return this.client.cache.delete(this.cacheName, key)
} }
/** Get an Array of values from Cache */ /** Gets an Array of values from Cache */
async array(): Promise<undefined | T2[]> { async array(): Promise<undefined | T2[]> {
let arr = await (this.client.cache.array(this.cacheName) as T[]) let arr = await (this.client.cache.array(this.cacheName) as T[])
if (arr === undefined) arr = [] if (arr === undefined) arr = []
return arr.map((e) => new this.DataType(this.client, e)) as any return arr.map((e) => new this.DataType(this.client, e)) as any
} }
/** Get a Collection of values from Cache */ /** Gets a Collection of values from Cache */
async collection(): Promise<Collection<string, T2>> { async collection(): Promise<Collection<string, T2>> {
const arr = await this.array() const arr = await this.array()
if (arr === undefined) return new Collection() if (arr === undefined) return new Collection()
@ -60,7 +60,7 @@ export class BaseManager<T, T2> {
return collection return collection
} }
/** Delete everything from Cache */ /** Deletes everything from Cache */
flush(): any { flush(): any {
return this.client.cache.deleteCache(this.cacheName) return this.client.cache.deleteCache(this.cacheName)
} }

View file

@ -43,7 +43,7 @@ export class ChannelsManager extends BaseManager<ChannelPayload, Channel> {
return result return result
} }
/** Fetch a Channel by ID, cache it, resolve it */ /** Fetches a Channel by ID, cache it, resolve it */
async fetch<T = Channel>(id: string): Promise<T> { async fetch<T = Channel>(id: string): Promise<T> {
return await new Promise((resolve, reject) => { return await new Promise((resolve, reject) => {
this.client.rest this.client.rest

View file

@ -20,7 +20,7 @@ export class EmojisManager extends BaseManager<EmojiPayload, Emoji> {
return emoji return emoji
} }
/** Fetch an Emoji by Guild ID and Emoji ID, cache it and resolve it */ /** Fetches an Emoji by Guild ID and Emoji ID, cache it and resolve it */
async fetch(guildID: string, id: string): Promise<Emoji> { async fetch(guildID: string, id: string): Promise<Emoji> {
return await new Promise((resolve, reject) => { return await new Promise((resolve, reject) => {
this.client.rest this.client.rest

View file

@ -11,20 +11,20 @@ import {
* Methods can return Promises too. * Methods can return Promises too.
*/ */
export interface ICacheAdapter { export interface ICacheAdapter {
/** Get a key from a Cache */ /** Gets a key from a Cache */
get: (cacheName: string, key: string) => Promise<any> | any get: (cacheName: string, key: string) => Promise<any> | any
/** Set a key to value in a Cache Name with optional expire value in MS */ /** Sets a key to value in a Cache Name with optional expire value in MS */
set: ( set: (
cacheName: string, cacheName: string,
key: string, key: string,
value: any, value: any,
expire?: number expire?: number
) => Promise<any> | any ) => Promise<any> | any
/** Delete a key from a Cache */ /** Deletes a key from a Cache */
delete: (cacheName: string, key: string) => Promise<boolean> | boolean delete: (cacheName: string, key: string) => Promise<boolean> | boolean
/** Get array of all values in a Cache */ /** Gets array of all values in a Cache */
array: (cacheName: string) => undefined | any[] | Promise<any[] | undefined> array: (cacheName: string) => undefined | any[] | Promise<any[] | undefined>
/** Entirely delete a Cache */ /** Entirely deletes a Cache */
deleteCache: (cacheName: string) => any deleteCache: (cacheName: string) => any
} }

View file

@ -115,9 +115,9 @@ export class Client extends EventEmitter {
} }
/** /**
* Set Cache Adapter * Sets Cache Adapter
* *
* Should NOT set after bot is already logged in or using current cache. * Should NOT be set after bot is already logged in or using current cache.
* Please look into using `cache` option. * Please look into using `cache` option.
*/ */
setAdapter(adapter: ICacheAdapter): Client { setAdapter(adapter: ICacheAdapter): Client {
@ -125,7 +125,7 @@ export class Client extends EventEmitter {
return this return this
} }
/** Change Presence of Client */ /** Changes Presence of Client */
setPresence(presence: ClientPresence | ClientActivity | ActivityGame): void { setPresence(presence: ClientPresence | ClientActivity | ActivityGame): void {
if (presence instanceof ClientPresence) { if (presence instanceof ClientPresence) {
this.presence = presence this.presence = presence
@ -133,7 +133,7 @@ export class Client extends EventEmitter {
this.gateway?.sendPresence(this.presence.create()) this.gateway?.sendPresence(this.presence.create())
} }
/** Emit debug event */ /** Emits debug event */
debug(tag: string, msg: string): void { debug(tag: string, msg: string): void {
this.emit('debug', `[${tag}] ${msg}`) this.emit('debug', `[${tag}] ${msg}`)
} }
@ -157,7 +157,7 @@ export class Client extends EventEmitter {
// fetchApplication(): Promise<Application> // fetchApplication(): Promise<Application>
/** /**
* This function is used for connect to discord. * This function is used for connecting to discord.
* @param token Your token. This is required. * @param token Your token. This is required.
* @param intents Gateway intents in array. This is required. * @param intents Gateway intents in array. This is required.
*/ */

View file

@ -106,7 +106,7 @@ export class CommandClient extends Client implements CommandClientOptions {
) )
} }
/** Process a Message to Execute Command. */ /** Processes a Message to Execute Command. */
async processMessage(msg: Message): Promise<any> { async processMessage(msg: Message): Promise<any> {
if (!this.allowBots && msg.author.bot === true) return if (!this.allowBots && msg.author.bot === true) return
@ -227,7 +227,7 @@ export class CommandClient extends Client implements CommandClientOptions {
} }
// In these checks too, Command overrides Category if present // In these checks too, Command overrides Category if present
// Check if Command is only for Owners // Checks if Command is only for Owners
if ( if (
(command.ownerOnly !== undefined || category === undefined (command.ownerOnly !== undefined || category === undefined
? command.ownerOnly ? command.ownerOnly
@ -236,7 +236,7 @@ export class CommandClient extends Client implements CommandClientOptions {
) )
return this.emit('commandOwnerOnly', ctx, command) return this.emit('commandOwnerOnly', ctx, command)
// Check if Command is only for Guild // Checks if Command is only for Guild
if ( if (
(command.guildOnly !== undefined || category === undefined (command.guildOnly !== undefined || category === undefined
? command.guildOnly ? command.guildOnly
@ -245,7 +245,7 @@ export class CommandClient extends Client implements CommandClientOptions {
) )
return this.emit('commandGuildOnly', ctx, command) return this.emit('commandGuildOnly', ctx, command)
// Check if Command is only for DMs // Checks if Command is only for DMs
if ( if (
(command.dmOnly !== undefined || category === undefined (command.dmOnly !== undefined || category === undefined
? command.dmOnly ? command.dmOnly

View file

@ -12,14 +12,14 @@ export class ExtensionCommands {
this.extension = ext this.extension = ext
} }
/** Get a list of Extension's Commands */ /** Gets a list of Extension's Commands */
get list(): Collection<string, Command> { get list(): Collection<string, Command> {
return this.extension.client.commands.list.filter( return this.extension.client.commands.list.filter(
(c) => c.extension?.name === this.extension.name (c) => c.extension?.name === this.extension.name
) )
} }
/** Get an Extension Command */ /** Gets an Extension Command */
get(cmd: string): Command | undefined { get(cmd: string): Command | undefined {
const find = this.extension.client.commands.find(cmd) const find = this.extension.client.commands.find(cmd)
// linter sucks // linter sucks
@ -29,14 +29,14 @@ export class ExtensionCommands {
else return find else return find
} }
/** Add an Extension Command */ /** Adds an Extension Command */
add(Cmd: Command | typeof Command): boolean { add(Cmd: Command | typeof Command): boolean {
const cmd = Cmd instanceof Command ? Cmd : new Cmd() const cmd = Cmd instanceof Command ? Cmd : new Cmd()
cmd.extension = this.extension cmd.extension = this.extension
return this.extension.client.commands.add(cmd) return this.extension.client.commands.add(cmd)
} }
/** Delete an Extension Command */ /** Deletes an Extension Command */
delete(cmd: Command | string): boolean { delete(cmd: Command | string): boolean {
const find = this.extension.client.commands.find( const find = this.extension.client.commands.find(
typeof cmd === 'string' ? cmd : cmd.name typeof cmd === 'string' ? cmd : cmd.name
@ -50,7 +50,7 @@ export class ExtensionCommands {
else return this.extension.client.commands.delete(find) else return this.extension.client.commands.delete(find)
} }
/** Delete all Commands of an Extension */ /** Deletes all Commands of an Extension */
deleteAll(): void { deleteAll(): void {
for (const [cmd] of this.list) { for (const [cmd] of this.list) {
this.delete(cmd) this.delete(cmd)
@ -80,7 +80,7 @@ export class Extension {
} }
} }
/** Listen for an Event through Extension. */ /** Listens for an Event through Extension. */
listen(event: string, cb: ExtensionEventCallback): boolean { listen(event: string, cb: ExtensionEventCallback): boolean {
if (this.events[event] !== undefined) return false if (this.events[event] !== undefined) return false
else { else {
@ -109,17 +109,17 @@ export class ExtensionsManager {
this.client = client this.client = client
} }
/** Get an Extension by name */ /** Gets an Extension by name */
get(ext: string): Extension | undefined { get(ext: string): Extension | undefined {
return this.list.get(ext) return this.list.get(ext)
} }
/** Check whether an Extension exists or not */ /** Checks whether an Extension exists or not */
exists(ext: string): boolean { exists(ext: string): boolean {
return this.get(ext) !== undefined return this.get(ext) !== undefined
} }
/** Load an Extension onto Command Client */ /** Loads an Extension onto Command Client */
load(ext: Extension | typeof Extension): void { load(ext: Extension | typeof Extension): void {
// eslint-disable-next-line new-cap // eslint-disable-next-line new-cap
if (!(ext instanceof Extension)) ext = new ext(this.client) if (!(ext instanceof Extension)) ext = new ext(this.client)
@ -129,7 +129,7 @@ export class ExtensionsManager {
ext.load() ext.load()
} }
/** Unload an Extension from Command Client */ /** Unloads an Extension from Command Client */
unload(ext: Extension | string): boolean { unload(ext: Extension | string): boolean {
const name = typeof ext === 'string' ? ext : ext.name const name = typeof ext === 'string' ? ext : ext.name
const extension = this.get(name) const extension = this.get(name)

View file

@ -320,7 +320,7 @@ export class RESTManager {
} }
/** /**
* Make a Request to Discord API * Makes a Request to Discord API
* @param method HTTP Method to use * @param method HTTP Method to use
* @param url URL of the Request * @param url URL of the Request
* @param body Body to send with Request * @param body Body to send with Request
@ -422,7 +422,7 @@ export class RESTManager {
}) })
} }
/** Make a GET Request to API */ /** Makes a GET Request to API */
async get( async get(
url: string, url: string,
body?: unknown, body?: unknown,
@ -433,7 +433,7 @@ export class RESTManager {
return await this.make('get', url, body, maxRetries, bucket, rawResponse) return await this.make('get', url, body, maxRetries, bucket, rawResponse)
} }
/** Make a POST Request to API */ /** Makes a POST Request to API */
async post( async post(
url: string, url: string,
body?: unknown, body?: unknown,
@ -444,7 +444,7 @@ export class RESTManager {
return await this.make('post', url, body, maxRetries, bucket, rawResponse) return await this.make('post', url, body, maxRetries, bucket, rawResponse)
} }
/** Make a DELETE Request to API */ /** Makes a DELETE Request to API */
async delete( async delete(
url: string, url: string,
body?: unknown, body?: unknown,
@ -455,7 +455,7 @@ export class RESTManager {
return await this.make('delete', url, body, maxRetries, bucket, rawResponse) return await this.make('delete', url, body, maxRetries, bucket, rawResponse)
} }
/** Make a PATCH Request to API */ /** Makes a PATCH Request to API */
async patch( async patch(
url: string, url: string,
body?: unknown, body?: unknown,
@ -466,7 +466,7 @@ export class RESTManager {
return await this.make('patch', url, body, maxRetries, bucket, rawResponse) return await this.make('patch', url, body, maxRetries, bucket, rawResponse)
} }
/** Make a PUT Request to API */ /** Makes a PUT Request to API */
async put( async put(
url: string, url: string,
body?: unknown, body?: unknown,

View file

@ -45,7 +45,7 @@ export class GuildBans {
} }
/** /**
* Get all bans in the Guild. * Gets all bans in the Guild.
*/ */
async all(): Promise<GuildBan[]> { async all(): Promise<GuildBan[]> {
const res = await this.client.rest.get(GUILD_BANS(this.guild.id)) const res = await this.client.rest.get(GUILD_BANS(this.guild.id))
@ -59,7 +59,7 @@ export class GuildBans {
} }
/** /**
* Get ban details of a User if any. * Gets ban details of a User if any.
* @param user User to get ban of, ID or User object. * @param user User to get ban of, ID or User object.
*/ */
async get(user: string | User): Promise<GuildBan> { async get(user: string | User): Promise<GuildBan> {
@ -71,7 +71,7 @@ export class GuildBans {
} }
/** /**
* Ban a User. * Bans a User.
* @param user User to ban, ID or User object. * @param user User to ban, ID or User object.
* @param reason Reason for the Ban. * @param reason Reason for the Ban.
* @param deleteMessagesDays Delete Old Messages? If yes, how much days. * @param deleteMessagesDays Delete Old Messages? If yes, how much days.
@ -95,7 +95,7 @@ export class GuildBans {
} }
/** /**
* Unban (remove ban from) a User. * Unbans (removes ban from) a User.
* @param user User to unban, ID or User object. * @param user User to unban, ID or User object.
*/ */
async remove(user: string | User): Promise<boolean> { async remove(user: string | User): Promise<boolean> {
@ -271,7 +271,7 @@ export class Guild extends Base {
} }
/** /**
* Get Everyone role of the Guild * Gets Everyone role of the Guild
*/ */
async getEveryoneRole(): Promise<Role> { async getEveryoneRole(): Promise<Role> {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
@ -279,7 +279,7 @@ export class Guild extends Base {
} }
/** /**
* Get current client's member in the Guild * Gets current client's member in the Guild
*/ */
async me(): Promise<Member> { async me(): Promise<Member> {
const get = await this.members.get(this.client.user?.id as string) const get = await this.members.get(this.client.user?.id as string)
@ -288,7 +288,7 @@ export class Guild extends Base {
} }
/** /**
* Fetch Guild's Integrations (Webhooks, Bots, etc.) * Fetches Guild's Integrations (Webhooks, Bots, etc.)
*/ */
async fetchIntegrations(): Promise<GuildIntegration[]> { async fetchIntegrations(): Promise<GuildIntegration[]> {
const raw = (await this.client.rest.get( const raw = (await this.client.rest.get(
@ -298,7 +298,7 @@ export class Guild extends Base {
} }
/** /**
* Chunk the Guild Members, i.e. cache them. * Chunks the Guild Members, i.e. cache them.
* @param options Options regarding the Members Request * @param options Options regarding the Members Request
* @param wait Whether to wait for all Members to come before resolving Promise or not. * @param wait Whether to wait for all Members to come before resolving Promise or not.
* @param timeout Configurable timeout to cancel the wait to safely remove listener. * @param timeout Configurable timeout to cancel the wait to safely remove listener.
@ -344,7 +344,7 @@ export class GuildIntegration extends Base {
expireGracePeriod?: number expireGracePeriod?: number
user?: User user?: User
account: IntegrationAccountPayload account: IntegrationAccountPayload
syncedAt?: string // Actually a ISO Timestamp, but we parse in constructor' syncedAt?: string // Actually a ISO Timestamp, but we parse in constructor
subscriberCount?: number subscriberCount?: number
revoked?: boolean revoked?: boolean
application?: Application application?: Application

View file

@ -65,7 +65,7 @@ export class Member extends Base {
} }
/** /**
* Update the Member data in cache (and this object). * Updates the Member data in cache (and this object).
*/ */
async fetch(): Promise<Member> { async fetch(): Promise<Member> {
const raw = await this.client.rest.get(this.id) const raw = await this.client.rest.get(this.id)
@ -76,7 +76,7 @@ export class Member extends Base {
} }
/** /**
* Edit the Member * Edits the Member
* @param data Data to apply * @param data Data to apply
*/ */
async edit(data: MemberData): Promise<Member> { async edit(data: MemberData): Promise<Member> {
@ -113,14 +113,14 @@ export class Member extends Base {
} }
/** /**
* Reset nickname of the Member * Resets nickname of the Member
*/ */
async resetNickname(): Promise<Member> { async resetNickname(): Promise<Member> {
return await this.setNickname() return await this.setNickname()
} }
/** /**
* Set mute of a Member in VC * Sets a Member mute in VC
* @param mute Value to set * @param mute Value to set
*/ */
async setMute(mute?: boolean): Promise<Member> { async setMute(mute?: boolean): Promise<Member> {
@ -130,7 +130,7 @@ export class Member extends Base {
} }
/** /**
* Set deaf of a Member in VC * Sets a Member deaf in VC
* @param deaf Value to set * @param deaf Value to set
*/ */
async setDeaf(deaf?: boolean): Promise<Member> { async setDeaf(deaf?: boolean): Promise<Member> {
@ -140,14 +140,14 @@ export class Member extends Base {
} }
/** /**
* Unmute the Member from VC. * Unmutes the Member from VC.
*/ */
async unmute(): Promise<Member> { async unmute(): Promise<Member> {
return await this.setMute(false) return await this.setMute(false)
} }
/** /**
* Kick the member. * Kicks the member.
*/ */
async kick(): Promise<boolean> { async kick(): Promise<boolean> {
const resp = await this.client.rest.delete( const resp = await this.client.rest.delete(
@ -162,7 +162,7 @@ export class Member extends Base {
} }
/** /**
* Ban the Member. * Bans the Member.
* @param reason Reason for the Ban. * @param reason Reason for the Ban.
* @param deleteMessagesDays Delete Old Messages? If yes, how much days. * @param deleteMessagesDays Delete Old Messages? If yes, how much days.
*/ */

View file

@ -94,7 +94,7 @@ export class Message extends Base {
this.flags = data.flags ?? this.flags this.flags = data.flags ?? this.flags
} }
/** Edit this message. */ /** Edits this message. */
async edit(text?: string, option?: MessageOption): Promise<Message> { async edit(text?: string, option?: MessageOption): Promise<Message> {
if ( if (
this.client.user !== undefined && this.client.user !== undefined &&
@ -104,7 +104,7 @@ export class Message extends Base {
return this.channel.editMessage(this.id, text, option) return this.channel.editMessage(this.id, text, option)
} }
/** Create a Reply to this Message. */ /** Creates a Reply to this Message. */
async reply( async reply(
text?: string | AllMessageOptions, text?: string | AllMessageOptions,
option?: AllMessageOptions option?: AllMessageOptions
@ -112,7 +112,7 @@ export class Message extends Base {
return this.channel.send(text, option, this) return this.channel.send(text, option, this)
} }
/** Delete the Message. */ /** Deletes the Message. */
async delete(): Promise<void> { async delete(): Promise<void> {
return this.client.rest.delete(CHANNEL_MESSAGE(this.channelID, this.id)) return this.client.rest.delete(CHANNEL_MESSAGE(this.channelID, this.id))
} }

View file

@ -89,7 +89,7 @@ export class Webhook {
return this return this
} }
/** Send a Message through Webhook. */ /** Sends a Message through Webhook. */
async send( async send(
text?: string | AllWebhookMessageOptions, text?: string | AllWebhookMessageOptions,
option?: AllWebhookMessageOptions option?: AllWebhookMessageOptions
@ -149,7 +149,7 @@ export class Webhook {
} }
/** /**
* Create a Webhook object from URL * Creates a Webhook object from URL
* @param url URL of the Webhook * @param url URL of the Webhook
* @param client Client (bot) object, if any. * @param client Client (bot) object, if any.
*/ */
@ -165,7 +165,7 @@ export class Webhook {
} }
/** /**
* Edit the Webhook name, avatar, or channel (requires authentication). * Edits the Webhook name, avatar, or channel (requires authentication).
* @param options Options to edit the Webhook. * @param options Options to edit the Webhook.
*/ */
async edit(options: WebhookEditOptions): Promise<Webhook> { async edit(options: WebhookEditOptions): Promise<Webhook> {
@ -185,7 +185,7 @@ export class Webhook {
return this return this
} }
/** Delete the Webhook. */ /** Deletes the Webhook. */
async delete(): Promise<boolean> { async delete(): Promise<boolean> {
const resp = await this.rest.delete(this.url, undefined, 0, undefined, true) const resp = await this.rest.delete(this.url, undefined, 0, undefined, true)
if (resp.response.status !== 204) return false if (resp.response.status !== 204) return false

View file

@ -16,7 +16,7 @@ import { UserPayload } from './user.ts'
/** /**
* Gateway OPcodes from Discord docs. * Gateway OPcodes from Discord docs.
*/ */
export enum GatewayOpcodes { // 문서를 확인해본 결과 Opcode 5번은 비어있다. - UnderC - export enum GatewayOpcodes { // Opcode 5 is empty according to discord api docs.
DISPATCH = 0, DISPATCH = 0,
HEARTBEAT = 1, HEARTBEAT = 1,
IDENTIFY = 2, IDENTIFY = 2,

View file

@ -136,7 +136,7 @@ export interface GuildIntegrationPayload {
expire_grace_period?: number expire_grace_period?: number
user?: UserPayload user?: UserPayload
account: IntegrationAccountPayload account: IntegrationAccountPayload
synced_at?: string // Actually a ISO Timestamp, but we parse in constructor' synced_at?: string // Actually a ISO Timestamp, but we parse in constructor
subscriber_count?: number subscriber_count?: number
revoked?: boolean revoked?: boolean
application?: ApplicationPayload application?: ApplicationPayload

View file

@ -1,7 +1,7 @@
// https://discord.com/developers/docs/topics/opcodes-and-status-codes#voice // https://discord.com/developers/docs/topics/opcodes-and-status-codes#voice
import { MemberPayload } from './guild.ts' import { MemberPayload } from './guild.ts'
export enum VoiceOpcodes { // VoiceOpcodes 추가 - UnderC - export enum VoiceOpcodes { // add VoiceOpcodes - UnderC -
IDENTIFY = 0, IDENTIFY = 0,
SELECT_PROTOCOL = 1, SELECT_PROTOCOL = 1,
READY = 2, READY = 2,

View file

@ -54,7 +54,7 @@ export class Collection<K = string, V = any> extends Map<K, V> {
return results return results
} }
/** Check if any of the values/keys in Collection satisfy callback */ /** Check if any of the values/keys in Collection satisfies callback */
some(callback: (value: V, key: K) => boolean): boolean { some(callback: (value: V, key: K) => boolean): boolean {
for (const key of this.keys()) { for (const key of this.keys()) {
const value = this.get(key) as V const value = this.get(key) as V
@ -63,7 +63,7 @@ export class Collection<K = string, V = any> extends Map<K, V> {
return false return false
} }
/** Check if every value/key in Collection satisfy callback */ /** Check if every value/key in Collection satisfies callback */
every(callback: (value: V, key: K) => boolean): boolean { every(callback: (value: V, key: K) => boolean): boolean {
for (const key of this.keys()) { for (const key of this.keys()) {
const value = this.get(key) as V const value = this.get(key) as V