Skip to main content

Class: RouteStore

api/src.RouteStore

since 1.0.0

Hierarchy

  • Store<Route>

    RouteStore

Constructors

constructor

new RouteStore()

Overrides

Store<Route\>.constructor

Defined in

projects/plugins/packages/api/src/lib/structures/RouteStore.ts:26

Properties

Constructor

Readonly Constructor: Constructor<Route>

Inherited from

Store.Constructor

Defined in

node_modules/@sapphire/pieces/dist/index.d.ts:281


[toStringTag]

Readonly [toStringTag]: string

Inherited from

Store.__@toStringTag@102092

Defined in

node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:135


constructor

constructor: CollectionConstructor

Inherited from

Store.constructor

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:21


name

Readonly name: string

Inherited from

Store.name

Defined in

node_modules/@sapphire/pieces/dist/index.d.ts:282


paths

Readonly paths: Set<string>

Inherited from

Store.paths

Defined in

node_modules/@sapphire/pieces/dist/index.d.ts:283


size

Readonly size: number

Inherited from

Store.size

Defined in

node_modules/typescript/lib/lib.es2015.collection.d.ts:28


strategy

Readonly strategy: ILoaderStrategy<Route>

Inherited from

Store.strategy

Defined in

node_modules/@sapphire/pieces/dist/index.d.ts:284


table

Readonly table: Collection<Methods, Collection<Route, MethodCallback>>

Defined in

projects/plugins/packages/api/src/lib/structures/RouteStore.ts:24


[species]

Static Readonly [species]: MapConstructor

Inherited from

Store.__@species@102238

Defined in

node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:317


default

Static Readonly default: typeof Collection

Inherited from

Store.default

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:28


defaultStrategy

Static defaultStrategy: ILoaderStrategy<any>

The default strategy, defaults to {@link LoaderStrategy}, which is constructed on demand when a store is constructed, when none was set beforehand.

Inherited from

Store.defaultStrategy

Defined in

node_modules/@sapphire/pieces/dist/index.d.ts:369


logger

Static logger: null | StoreLogger

The default logger, defaults to null.

Inherited from

Store.logger

Defined in

node_modules/@sapphire/pieces/dist/index.d.ts:373

Accessors

container

get container(): Container

A reference to the {@link Container} object for ease of use.

see container

Returns

Container

Inherited from

Store.container

Defined in

node_modules/@sapphire/pieces/dist/index.d.ts:294

Methods

[iterator]

[iterator](): IterableIterator<[string, Route]>

Returns an iterable of entries in the map.

Returns

IterableIterator<[string, Route]>

Inherited from

Store.__@iterator@102020

Defined in

node_modules/typescript/lib/lib.es2015.iterable.d.ts:121


at

at(index): undefined | Route

Identical to Array.at(). Returns the item at a given index, allowing for positive and negative integers. Negative integers count back from the last item in the collection.

Parameters

NameTypeDescription
indexnumberThe index of the element to obtain

Returns

undefined | Route

Inherited from

Store.at

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:101


clear

clear(): void

Returns

void

Inherited from

Store.clear

Defined in

node_modules/typescript/lib/lib.es2015.collection.d.ts:22


clone

clone(): Collection<string, Route>

Creates an identical shallow copy of this collection.

example const newColl = someColl.clone();

Returns

Collection<string, Route>

Inherited from

Store.clone

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:320


concat

concat(...collections): Collection<string, Route>

Combines this collection with others into a new collection. None of the source collections are modified.

example const newColl = someColl.concat(someOtherColl, anotherColl, ohBoyAColl);

Parameters

NameTypeDescription
...collectionsReadonlyCollection<string, Route>[]Collections to merge

Returns

Collection<string, Route>

Inherited from

Store.concat

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:329


construct

construct(Ctor, data): Route

Constructs a {@link Piece} instance.

Parameters

NameTypeDescription
CtorILoaderResultEntry<Route>The {@link Piece}'s constructor used to build the instance.
dataHydratedModuleDataThe module's information

Returns

Route

An instance of the constructed piece.

Inherited from

Store.construct

Defined in

node_modules/@sapphire/pieces/dist/index.d.ts:345


delete

delete(key): boolean

Parameters

NameType
keystring

Returns

boolean

Inherited from

Store.delete

Defined in

node_modules/typescript/lib/lib.es2015.collection.d.ts:23


difference

difference<T>(other): Collection<string, Route | T>

The difference method returns a new structure containing items where the key is present in one of the original structures but not the other.

Type parameters

Name
T

Parameters

NameTypeDescription
otherReadonlyCollection<string, T>The other Collection to filter against

Returns

Collection<string, Route | T>

Inherited from

Store.difference

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:363


each

each(fn): RouteStore

Identical to Map.forEach(), but returns the collection instead of undefined.

example collection .each(user => console.log(user.username)) .filter(user => user.bot) .each(user => console.log(user.username));

Parameters

NameTypeDescription
fn(value: Route, key: string, collection: RouteStore) => voidFunction to execute for each element

Returns

RouteStore

Inherited from

Store.each

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:298

each<T>(fn, thisArg): RouteStore

Type parameters

Name
T

Parameters

NameType
fn(this: T, value: Route, key: string, collection: RouteStore) => void
thisArgT

Returns

RouteStore

Inherited from

Store.each

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:299


ensure

ensure(key, defaultValueGenerator): Route

Obtains the value of the given key if it exists, otherwise sets and returns the value provided by the default value generator.

example collection.ensure(guildId, () => defaultGuildConfig);

Parameters

NameTypeDescription
keystringThe key to get if it exists, or set otherwise
defaultValueGenerator(key: string, collection: RouteStore) => RouteA function that generates the default value

Returns

Route

Inherited from

Store.ensure

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:38


entries

entries(): IterableIterator<[string, Route]>

Returns an iterable of key, value pairs for every entry in the map.

Returns

IterableIterator<[string, Route]>

Inherited from

Store.entries

Defined in

node_modules/typescript/lib/lib.es2015.iterable.d.ts:126


equals

equals(collection): boolean

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.

Parameters

NameTypeDescription
collectionReadonlyCollection<string, Route>Collection to compare with

Returns

boolean

Whether the collections have identical contents

Inherited from

Store.equals

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:339


every

every<K2>(fn): this is Collection<K2, Route>

Checks if all items passes a test. Identical in behavior to Array.every().

example collection.every(user => !user.bot);

Type parameters

NameType
K2extends string

Parameters

NameTypeDescription
fn(value: Route, key: string, collection: RouteStore) => key is K2Function used to test (should return a boolean)

Returns

this is Collection<K2, Route>

Inherited from

Store.every

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:266

every<V2>(fn): this is Collection<string, V2>

Type parameters

NameType
V2extends Route<V2>

Parameters

NameType
fn(value: Route, key: string, collection: RouteStore) => value is V2

Returns

this is Collection<string, V2>

Inherited from

Store.every

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:267

every(fn): boolean

Parameters

NameType
fn(value: Route, key: string, collection: RouteStore) => boolean

Returns

boolean

Inherited from

Store.every

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:268

every<This, K2>(fn, thisArg): this is Collection<K2, Route>

Type parameters

NameType
ThisThis
K2extends string

Parameters

NameType
fn(this: This, value: Route, key: string, collection: RouteStore) => key is K2
thisArgThis

Returns

this is Collection<K2, Route>

Inherited from

Store.every

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:269

every<This, V2>(fn, thisArg): this is Collection<string, V2>

Type parameters

NameType
ThisThis
V2extends Route<V2>

Parameters

NameType
fn(this: This, value: Route, key: string, collection: RouteStore) => value is V2
thisArgThis

Returns

this is Collection<string, V2>

Inherited from

Store.every

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:270

every<This>(fn, thisArg): boolean

Type parameters

Name
This

Parameters

NameType
fn(this: This, value: Route, key: string, collection: RouteStore) => boolean
thisArgThis

Returns

boolean

Inherited from

Store.every

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:271


filter

filter<K2>(fn): Collection<K2, Route>

Identical to Array.filter(), but returns a Collection instead of an Array.

example collection.filter(user => user.username === 'Bob');

Type parameters

NameType
K2extends string

Parameters

NameTypeDescription
fn(value: Route, key: string, collection: RouteStore) => key is K2The function to test with (should return boolean)

Returns

Collection<K2, Route>

Inherited from

Store.filter

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:186

filter<V2>(fn): Collection<string, V2>

Type parameters

NameType
V2extends Route<V2>

Parameters

NameType
fn(value: Route, key: string, collection: RouteStore) => value is V2

Returns

Collection<string, V2>

Inherited from

Store.filter

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:187

filter(fn): Collection<string, Route>

Parameters

NameType
fn(value: Route, key: string, collection: RouteStore) => boolean

Returns

Collection<string, Route>

Inherited from

Store.filter

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:188

filter<This, K2>(fn, thisArg): Collection<K2, Route>

Type parameters

NameType
ThisThis
K2extends string

Parameters

NameType
fn(this: This, value: Route, key: string, collection: RouteStore) => key is K2
thisArgThis

Returns

Collection<K2, Route>

Inherited from

Store.filter

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:189

filter<This, V2>(fn, thisArg): Collection<string, V2>

Type parameters

NameType
ThisThis
V2extends Route<V2>

Parameters

NameType
fn(this: This, value: Route, key: string, collection: RouteStore) => value is V2
thisArgThis

Returns

Collection<string, V2>

Inherited from

Store.filter

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:190

filter<This>(fn, thisArg): Collection<string, Route>

Type parameters

Name
This

Parameters

NameType
fn(this: This, value: Route, key: string, collection: RouteStore) => boolean
thisArgThis

Returns

Collection<string, Route>

Inherited from

Store.filter

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:191


find

find<V2>(fn): undefined | V2

Searches for a single item where the given function returns a truthy value. This behaves like Array.find().

All collections used in Discord.js are mapped using their `id` property, and if you want to find by id you should use the `get` method. See [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/get) for details.

example collection.find(user => user.username === 'Bob');

Type parameters

NameType
V2extends Route<V2>

Parameters

NameTypeDescription
fn(value: Route, key: string, collection: RouteStore) => value is V2The function to test with (should return boolean)

Returns

undefined | V2

Inherited from

Store.find

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:146

find(fn): undefined | Route

Parameters

NameType
fn(value: Route, key: string, collection: RouteStore) => boolean

Returns

undefined | Route

Inherited from

Store.find

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:147

find<This, V2>(fn, thisArg): undefined | V2

Type parameters

NameType
ThisThis
V2extends Route<V2>

Parameters

NameType
fn(this: This, value: Route, key: string, collection: RouteStore) => value is V2
thisArgThis

Returns

undefined | V2

Inherited from

Store.find

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:148

find<This>(fn, thisArg): undefined | Route

Type parameters

Name
This

Parameters

NameType
fn(this: This, value: Route, key: string, collection: RouteStore) => boolean
thisArgThis

Returns

undefined | Route

Inherited from

Store.find

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:149


findKey

findKey<K2>(fn): undefined | K2

Searches for the key of a single item where the given function returns a truthy value. This behaves like Array.findIndex(), but returns the key rather than the positional index.

example collection.findKey(user => user.username === 'Bob');

Type parameters

NameType
K2extends string

Parameters

NameTypeDescription
fn(value: Route, key: string, collection: RouteStore) => key is K2The function to test with (should return boolean)

Returns

undefined | K2

Inherited from

Store.findKey

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:161

findKey(fn): undefined | string

Parameters

NameType
fn(value: Route, key: string, collection: RouteStore) => boolean

Returns

undefined | string

Inherited from

Store.findKey

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:162

findKey<This, K2>(fn, thisArg): undefined | K2

Type parameters

NameType
ThisThis
K2extends string

Parameters

NameType
fn(this: This, value: Route, key: string, collection: RouteStore) => key is K2
thisArgThis

Returns

undefined | K2

Inherited from

Store.findKey

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:163

findKey<This>(fn, thisArg): undefined | string

Type parameters

Name
This

Parameters

NameType
fn(this: This, value: Route, key: string, collection: RouteStore) => boolean
thisArgThis

Returns

undefined | string

Inherited from

Store.findKey

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:164


first

first(): undefined | Route

Obtains the first value(s) in this collection.

Returns

undefined | Route

A single value if no amount is provided or an array of values, starting from the end if amount is negative

Inherited from

Store.first

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:62

first(amount): Route[]

Parameters

NameType
amountnumber

Returns

Route[]

Inherited from

Store.first

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:63


firstKey

firstKey(): undefined | string

Obtains the first key(s) in this collection.

Returns

undefined | string

A single key if no amount is provided or an array of keys, starting from the end if amount is negative

Inherited from

Store.firstKey

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:72

firstKey(amount): string[]

Parameters

NameType
amountnumber

Returns

string[]

Inherited from

Store.firstKey

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:73


flatMap

flatMap<T>(fn): Collection<string, T>

Maps each item into a Collection, then joins the results into a single Collection. Identical in behavior to Array.flatMap().

example collection.flatMap(guild => guild.members.cache);

Type parameters

Name
T

Parameters

NameTypeDescription
fn(value: Route, key: string, collection: RouteStore) => Collection<string, T>Function that produces a new Collection

Returns

Collection<string, T>

Inherited from

Store.flatMap

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:218

flatMap<T, This>(fn, thisArg): Collection<string, T>

Type parameters

Name
T
This

Parameters

NameType
fn(this: This, value: Route, key: string, collection: RouteStore) => Collection<string, T>
thisArgThis

Returns

Collection<string, T>

Inherited from

Store.flatMap

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:219


forEach

forEach(callbackfn, thisArg?): void

Parameters

NameType
callbackfn(value: Route, key: string, map: Map<string, Route>) => void
thisArg?any

Returns

void

Inherited from

Store.forEach

Defined in

node_modules/typescript/lib/lib.es2015.collection.d.ts:24


get

get(key): undefined | Route

Parameters

NameType
keystring

Returns

undefined | Route

Inherited from

Store.get

Defined in

node_modules/typescript/lib/lib.es2015.collection.d.ts:25


has

has(key): boolean

Parameters

NameType
keystring

Returns

boolean

Inherited from

Store.has

Defined in

node_modules/typescript/lib/lib.es2015.collection.d.ts:26


hasAll

hasAll(...keys): boolean

Checks if all of the elements exist in the collection.

Parameters

NameTypeDescription
...keysstring[]The keys of the elements to check for

Returns

boolean

true if all of the elements exist, false if at least one does not exist.

Inherited from

Store.hasAll

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:46


hasAny

hasAny(...keys): boolean

Checks if any of the elements exist in the collection.

Parameters

NameTypeDescription
...keysstring[]The keys of the elements to check for

Returns

boolean

true if any of the elements exist, false if none exist.

Inherited from

Store.hasAny

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:54


insert

insert(piece): Promise<Route>

Inserts a piece into the store.

Parameters

NameTypeDescription
pieceRouteThe piece to be inserted into the store.

Returns

Promise<Route>

The inserted piece.

Inherited from

Store.insert

Defined in

node_modules/@sapphire/pieces/dist/index.d.ts:338


intersect

intersect<T>(other): Collection<string, T>

The intersect method returns a new structure containing items where the keys and values are present in both original structures.

Type parameters

Name
T

Parameters

NameTypeDescription
otherReadonlyCollection<string, T>The other Collection to filter against

Returns

Collection<string, T>

Inherited from

Store.intersect

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:357


keyAt

keyAt(index): undefined | string

Identical to Array.at(). Returns the key at a given index, allowing for positive and negative integers. Negative integers count back from the last item in the collection.

Parameters

NameTypeDescription
indexnumberThe index of the key to obtain

Returns

undefined | string

Inherited from

Store.keyAt

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:109


keys

keys(): IterableIterator<string>

Returns an iterable of keys in the map

Returns

IterableIterator<string>

Inherited from

Store.keys

Defined in

node_modules/typescript/lib/lib.es2015.iterable.d.ts:131


last

last(): undefined | Route

Obtains the last value(s) in this collection.

Returns

undefined | Route

A single value if no amount is provided or an array of values, starting from the start if amount is negative

Inherited from

Store.last

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:82

last(amount): Route[]

Parameters

NameType
amountnumber

Returns

Route[]

Inherited from

Store.last

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:83


lastKey

lastKey(): undefined | string

Obtains the last key(s) in this collection.

Returns

undefined | string

A single key if no amount is provided or an array of keys, starting from the start if amount is negative

Inherited from

Store.lastKey

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:92

lastKey(amount): string[]

Parameters

NameType
amountnumber

Returns

string[]

Inherited from

Store.lastKey

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:93


load

load(root, path): Promise<Route[]>

Loads one or more pieces from a path.

Parameters

NameTypeDescription
rootstringThe root directory the file is from.
pathstringThe path of the file to load, relative to the root.

Returns

Promise<Route[]>

All the loaded pieces.

Inherited from

Store.load

Defined in

node_modules/@sapphire/pieces/dist/index.d.ts:312


loadAll

loadAll(): Promise<void>

Loads all pieces from all directories specified by paths.

Returns

Promise<void>

Inherited from

Store.loadAll

Defined in

node_modules/@sapphire/pieces/dist/index.d.ts:326


map

map<T>(fn): T[]

Maps each item to another value into an array. Identical in behavior to Array.map().

example collection.map(user => user.tag);

Type parameters

Name
T

Parameters

NameTypeDescription
fn(value: Route, key: string, collection: RouteStore) => TFunction that produces an element of the new array, taking three arguments

Returns

T[]

Inherited from

Store.map

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:230

map<This, T>(fn, thisArg): T[]

Type parameters

Name
This
T

Parameters

NameType
fn(this: This, value: Route, key: string, collection: RouteStore) => T
thisArgThis

Returns

T[]

Inherited from

Store.map

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:231


mapValues

mapValues<T>(fn): Collection<string, T>

Maps each item to another value into a collection. Identical in behavior to Array.map().

example collection.mapValues(user => user.tag);

Type parameters

Name
T

Parameters

NameTypeDescription
fn(value: Route, key: string, collection: RouteStore) => TFunction that produces an element of the new collection, taking three arguments

Returns

Collection<string, T>

Inherited from

Store.mapValues

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:242

mapValues<This, T>(fn, thisArg): Collection<string, T>

Type parameters

Name
This
T

Parameters

NameType
fn(this: This, value: Route, key: string, collection: RouteStore) => T
thisArgThis

Returns

Collection<string, T>

Inherited from

Store.mapValues

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:243


match

match(request): null | RouteMatch

Parameters

NameType
requestApiRequest

Returns

null | RouteMatch

Defined in

projects/plugins/packages/api/src/lib/structures/RouteStore.ts:32


merge

merge<T, R>(other, whenInSelf, whenInOther, whenInBoth): Collection<string, R>

Merges two Collections together into a new Collection.

example // Sums up the entries in two collections. coll.merge( other, x => ({ keep: true, value: x }), y => ({ keep: true, value: y }), (x, y) => ({ keep: true, value: x + y }), );

example // Intersects two collections in a left-biased manner. coll.merge( other, x => ({ keep: false }), y => ({ keep: false }), (x, _) => ({ keep: true, value: x }), );

Type parameters

Name
T
R

Parameters

NameTypeDescription
otherReadonlyCollection<string, T>The other Collection to merge with
whenInSelf(value: Route, key: string) => Keep<R>Function getting the result if the entry only exists in this Collection
whenInOther(valueOther: T, key: string) => Keep<R>Function getting the result if the entry only exists in the other Collection
whenInBoth(value: Route, valueOther: T, key: string) => Keep<R>Function getting the result if the entry exists in both Collections

Returns

Collection<string, R>

Inherited from

Store.merge

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:389


parseURL

Private parseURL(url?): Object

Parameters

NameTypeDefault value
urlstring''

Returns

Object

NameType
querystringstring
splitsstring[]

Defined in

projects/plugins/packages/api/src/lib/structures/RouteStore.ts:63


partition

partition<K2>(fn): [Collection<K2, Route>, Collection<Exclude<string, K2>, Route>]

Partitions the collection into two collections where the first collection contains the items that passed and the second contains the items that failed.

example const [big, small] = collection.partition(guild => guild.memberCount > 250);

Type parameters

NameType
K2extends string

Parameters

NameTypeDescription
fn(value: Route, key: string, collection: RouteStore) => key is K2Function used to test (should return a boolean)

Returns

[Collection<K2, Route>, Collection<Exclude<string, K2>, Route>]

Inherited from

Store.partition

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:202

partition<V2>(fn): [Collection<string, V2>, Collection<string, Exclude<Route, V2>>]

Type parameters

NameType
V2extends Route<V2>

Parameters

NameType
fn(value: Route, key: string, collection: RouteStore) => value is V2

Returns

[Collection<string, V2>, Collection<string, Exclude<Route, V2>>]

Inherited from

Store.partition

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:203

partition(fn): [Collection<string, Route>, Collection<string, Route>]

Parameters

NameType
fn(value: Route, key: string, collection: RouteStore) => boolean

Returns

[Collection<string, Route>, Collection<string, Route>]

Inherited from

Store.partition

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:204

partition<This, K2>(fn, thisArg): [Collection<K2, Route>, Collection<Exclude<string, K2>, Route>]

Type parameters

NameType
ThisThis
K2extends string

Parameters

NameType
fn(this: This, value: Route, key: string, collection: RouteStore) => key is K2
thisArgThis

Returns

[Collection<K2, Route>, Collection<Exclude<string, K2>, Route>]

Inherited from

Store.partition

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:205

partition<This, V2>(fn, thisArg): [Collection<string, V2>, Collection<string, Exclude<Route, V2>>]

Type parameters

NameType
ThisThis
V2extends Route<V2>

Parameters

NameType
fn(this: This, value: Route, key: string, collection: RouteStore) => value is V2
thisArgThis

Returns

[Collection<string, V2>, Collection<string, Exclude<Route, V2>>]

Inherited from

Store.partition

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:206

partition<This>(fn, thisArg): [Collection<string, Route>, Collection<string, Route>]

Type parameters

Name
This

Parameters

NameType
fn(this: This, value: Route, key: string, collection: RouteStore) => boolean
thisArgThis

Returns

[Collection<string, Route>, Collection<string, Route>]

Inherited from

Store.partition

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:207


random

random(): undefined | Route

Obtains unique random value(s) from this collection.

Returns

undefined | Route

A single value if no amount is provided or an array of values

Inherited from

Store.random

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:117

random(amount): Route[]

Parameters

NameType
amountnumber

Returns

Route[]

Inherited from

Store.random

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:118


randomKey

randomKey(): undefined | string

Obtains unique random key(s) from this collection.

Returns

undefined | string

A single key if no amount is provided or an array

Inherited from

Store.randomKey

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:126

randomKey(amount): string[]

Parameters

NameType
amountnumber

Returns

string[]

Inherited from

Store.randomKey

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:127


reduce

reduce<T>(fn, initialValue?): T

Applies a function to produce a single value. Identical in behavior to Array.reduce().

example collection.reduce((acc, guild) => acc + guild.memberCount, 0);

Type parameters

Name
T

Parameters

NameTypeDescription
fn(accumulator: T, value: Route, key: string, collection: RouteStore) => TFunction used to reduce, taking four arguments; accumulator, currentValue, currentKey, and collection
initialValue?TStarting value for the accumulator

Returns

T

Inherited from

Store.reduce

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:283


registerPath

registerPath(path): RouteStore

Registers a directory into the store.

example

store
.registerPath(resolve('commands'))
.registerPath(resolve('third-party', 'commands'));

Parameters

NameTypeDescription
pathstringThe path to be added.

Returns

RouteStore

Inherited from

Store.registerPath

Defined in

node_modules/@sapphire/pieces/dist/index.d.ts:305


resolve

resolve(name): Route

Resolves a piece by its name or its instance.

Parameters

NameTypeDescription
namestring | RouteThe name of the piece or the instance itself.

Returns

Route

The resolved piece.

Inherited from

Store.resolve

Defined in

node_modules/@sapphire/pieces/dist/index.d.ts:332


reverse

reverse(): RouteStore

Identical to Array.reverse() but returns a Collection instead of an Array.

Returns

RouteStore

Inherited from

Store.reverse

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:132


set

set(key, value): RouteStore

Parameters

NameType
keystring
valueRoute

Returns

RouteStore

Inherited from

Store.set

Defined in

node_modules/typescript/lib/lib.es2015.collection.d.ts:27


some

some(fn): boolean

Checks if there exists an item that passes a test. Identical in behavior to Array.some().

example collection.some(user => user.discriminator === '0000');

Parameters

NameTypeDescription
fn(value: Route, key: string, collection: RouteStore) => booleanFunction used to test (should return a boolean)

Returns

boolean

Inherited from

Store.some

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:254

some<T>(fn, thisArg): boolean

Type parameters

Name
T

Parameters

NameType
fn(this: T, value: Route, key: string, collection: RouteStore) => boolean
thisArgT

Returns

boolean

Inherited from

Store.some

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:255


sort

sort(compareFunction?): RouteStore

The sort method sorts the items of a collection in place and returns it. The sort is not necessarily stable in Node 10 or older. The default sort order is according to string Unicode code points.

example collection.sort((userA, userB) => userA.createdTimestamp - userB.createdTimestamp);

Parameters

NameTypeDescription
compareFunction?Comparator<string, Route>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

RouteStore

Inherited from

Store.sort

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:351


sorted

sorted(compareFunction?): Collection<string, Route>

The sorted method sorts the items of a collection and returns it. The sort is not necessarily stable in Node 10 or older. The default sort order is according to string Unicode code points.

example collection.sorted((userA, userB) => userA.createdTimestamp - userB.createdTimestamp);

Parameters

NameTypeDescription
compareFunction?Comparator<string, Route>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<string, Route>

Inherited from

Store.sorted

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:402


sweep

sweep(fn): number

Removes items that satisfy the provided filter function.

Parameters

NameTypeDescription
fn(value: Route, key: string, collection: RouteStore) => booleanFunction used to test (should return a boolean)

Returns

number

The number of removed entries

Inherited from

Store.sweep

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:173

sweep<T>(fn, thisArg): number

Type parameters

Name
T

Parameters

NameType
fn(this: T, value: Route, key: string, collection: RouteStore) => boolean
thisArgT

Returns

number

Inherited from

Store.sweep

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:174


tap

tap(fn): RouteStore

Runs a function on the collection and returns the collection.

example collection .tap(coll => console.log(coll.size)) .filter(user => user.bot) .tap(coll => console.log(coll.size))

Parameters

NameTypeDescription
fn(collection: RouteStore) => voidFunction to execute

Returns

RouteStore

Inherited from

Store.tap

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:312

tap<T>(fn, thisArg): RouteStore

Type parameters

Name
T

Parameters

NameType
fn(this: T, collection: RouteStore) => void
thisArgT

Returns

RouteStore

Inherited from

Store.tap

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:313


toJSON

toJSON(): Route[]

Returns

Route[]

Inherited from

Store.toJSON

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:403


unload

unload(name): Promise<Route>

Unloads a piece given its instance or its name.

Parameters

NameTypeDescription
namestring | RouteThe name of the file to load.

Returns

Promise<Route>

Returns the piece that was unloaded.

Inherited from

Store.unload

Defined in

node_modules/@sapphire/pieces/dist/index.d.ts:318


unloadAll

unloadAll(): Promise<Route[]>

Unloads all pieces from the store.

Returns

Promise<Route[]>

Inherited from

Store.unloadAll

Defined in

node_modules/@sapphire/pieces/dist/index.d.ts:322


values

values(): IterableIterator<Route>

Returns an iterable of values in the map

Returns

IterableIterator<Route>

Inherited from

Store.values

Defined in

node_modules/typescript/lib/lib.es2015.iterable.d.ts:136


combineEntries

Static combineEntries<K, V>(entries, combine): Collection<K, V>

Creates a Collection from a list of entries.

example Collection.combineEntries([["a", 1], ["b", 2], ["a", 2]], (x, y) => x + y); // returns Collection { "a" => 3, "b" => 2 }

Type parameters

Name
K
V

Parameters

NameTypeDescription
entriesIterable<[K, V]>The list of entries
combine(firstValue: V, secondValue: V, key: K) => VFunction to combine an existing entry with a new one

Returns

Collection<K, V>

Inherited from

Store.combineEntries

Defined in

node_modules/@discordjs/collection/dist/index.d.ts:414