hoshii / Exports / TypedCollection

TypedCollection<K, M, C, E>

Type parameters

NameType
Kextends string | number
Mextends Record<string, any>
Cextends Base
Eextends unknown[] = []

Hierarchy

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new TypedCollection<K, M, C, E>(baseObject, client, limit?)

Type parameters

NameType
Kextends string | number
Mextends Record<string, any>
Cextends Base<string | number, C>
Eextends unknown[] = []

Parameters

NameTypeDefault value
baseObjectAnyClass<M, C, E>undefined
clientClientundefined
limitnumberInfinity

Overrides

Collection.constructor

Defined in

lib/utils/TypedCollection.ts:23open in new window

Properties

[toStringTag]

Readonly [toStringTag]: string

Inherited from

Collection.[toStringTag]

Defined in

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


_baseObject

Private _baseObject: AnyClass<M, C, E>

Defined in

lib/utils/TypedCollection.ts:17open in new window


_client

Private _client: Client

Defined in

lib/utils/TypedCollection.ts:19open in new window


limit

limit: number

Defined in

lib/utils/TypedCollection.ts:21open in new window


size

Readonly size: number

Inherited from

Collection.size

Defined in

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


[species]

Static Readonly [species]: MapConstructor

Inherited from

Collection.[species]

Defined in

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

Accessors

empty

get empty(): boolean

If this collection is empty.

Returns

boolean

Inherited from

Collection.empty

Defined in

lib/utils/Collection.ts:3open in new window

Methods

[iterator]

[iterator](): IterableIterator<[K, C]>

Returns an iterable of entries in the map.

Returns

IterableIterator<[K, C]>

Inherited from

Collection.[iterator]

Defined in

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


clear

clear(): void

Returns

void

Inherited from

Collection.clear

Defined in

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


delete

delete(key): boolean

Parameters

NameType
keyK

Returns

boolean

true if an element in the Map existed and has been removed, or false if the element does not exist.

Inherited from

Collection.delete

Defined in

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


entries

entries(): IterableIterator<[K, C]>

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

Returns

IterableIterator<[K, C]>

Inherited from

Collection.entries

Defined in

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


every

every<T, ThisArg>(predicate, thisArg?): this is T[]

See: Array#everyopen in new window

Type parameters

NameType
Textends Base<string | number, T>
ThisArgCollection<K, C>

Parameters

NameType
predicate(value: C, index: number, array: C[]) => value is T
thisArg?ThisArg

Returns

this is T[]

Inherited from

Collection.every

Defined in

lib/utils/Collection.ts:8open in new window

every<ThisArg>(predicate, thisArg?): boolean

Type parameters

NameType
ThisArgCollection<K, C>

Parameters

NameType
predicate(value: C, index: number, array: C[]) => unknown
thisArg?ThisArg

Returns

boolean

Inherited from

Collection.every

Defined in

lib/utils/Collection.ts:13open in new window


filter

filter<S, ThisArg>(predicate, thisArg?): S[]

See: Array#filteropen in new window

Type parameters

NameType
Sextends Base<string | number, S>
ThisArgCollection<K, C>

Parameters

NameType
predicate(this: ThisArg, value: C, index: number, array: C[]) => value is S
thisArg?ThisArg

Returns

S[]

Inherited from

Collection.filter

Defined in

lib/utils/Collection.ts:26open in new window

filter<ThisArg>(predicate, thisArg?): C[]

Type parameters

NameType
ThisArgCollection<K, C>

Parameters

NameType
predicate(this: ThisArg, value: C, index: number, array: C[]) => unknown
thisArg?ThisArg

Returns

C[]

Inherited from

Collection.filter

Defined in

lib/utils/Collection.ts:36open in new window


find

find<S, ThisArg>(predicate, thisArg?): S

See: Array#findopen in new window

Type parameters

NameType
Sextends Base<string | number, S>
ThisArgCollection<K, C>

Parameters

NameType
predicate(this: ThisArg, value: C, index: number, obj: C[]) => value is S
thisArg?ThisArg

Returns

S

Inherited from

Collection.find

Defined in

lib/utils/Collection.ts:54open in new window

find<ThisArg>(predicate, thisArg?): C

Type parameters

NameType
ThisArgCollection<K, C>

Parameters

NameType
predicate(this: ThisArg, value: C, index: number, obj: C[]) => unknown
thisArg?ThisArg

Returns

C

Inherited from

Collection.find

Defined in

lib/utils/Collection.ts:64open in new window


findIndex

findIndex(predicate, thisArg?): number

See: Array#findIndexopen in new window

Parameters

NameType
predicate(value: C, index: number, obj: C[]) => unknown
thisArg?unknown

Returns

number

Inherited from

Collection.findIndex

Defined in

lib/utils/Collection.ts:82open in new window


first

first(): C

Get the first element, or first X elements if a number is provided.

Returns

C

Inherited from

Collection.first

Defined in

lib/utils/Collection.ts:93open in new window

first(amount): C[]

Parameters

NameType
amountnumber

Returns

C[]

Inherited from

Collection.first

Defined in

lib/utils/Collection.ts:95open in new window


forEach

forEach(callbackfn, thisArg?): void

Executes a provided function once per each key/value pair in the Map, in insertion order.

Parameters

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

Returns

void

Inherited from

Collection.forEach

Defined in

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


get

get(key): C

Returns a specified element from the Map object. If the value that is associated to the provided key is an object, then you will get a reference to that object and any change made to that object will effectively modify it inside the Map.

Parameters

NameType
keyK

Returns

C

Returns the element associated with the specified key. If no element is associated with the specified key, undefined is returned.

Inherited from

Collection.get

Defined in

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


has

has(key): boolean

Parameters

NameType
keyK

Returns

boolean

boolean indicating whether an element with the specified key exists or not.

Inherited from

Collection.has

Defined in

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


keys

keys(): IterableIterator<K>

Returns an iterable of keys in the map

Returns

IterableIterator<K>

Inherited from

Collection.keys

Defined in

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


last

last(): C

Get the last element, or last X elements if a number is provided.

Returns

C

Inherited from

Collection.last

Defined in

lib/utils/Collection.ts:117open in new window

last(amount): C[]

Parameters

NameType
amountnumber

Returns

C[]

Inherited from

Collection.last

Defined in

lib/utils/Collection.ts:119open in new window


map

map<T>(predicate, thisArg?): T[]

See: Array#mapopen in new window

Type parameters

Name
T

Parameters

NameType
predicate(value: C, index: number, obj: C[]) => T
thisArg?unknown

Returns

T[]

Inherited from

Collection.map

Defined in

lib/utils/Collection.ts:140open in new window


random

random(): C

Pick a random element from the collection, or undefined if the collection is empty.

Returns

C

Inherited from

Collection.random

Defined in

lib/utils/Collection.ts:150open in new window


reduce

reduce(predicate): C

See: Array#reduceopen in new window

Parameters

NameType
predicate(previousValue: C, currentValue: C, currentIndex: number, array: C[]) => C

Returns

C

Inherited from

Collection.reduce

Defined in

lib/utils/Collection.ts:161open in new window

reduce(predicate, initialValue): C

Parameters

NameType
predicate(previousValue: C, currentValue: C, currentIndex: number, array: C[]) => C
initialValueC

Returns

C

Inherited from

Collection.reduce

Defined in

lib/utils/Collection.ts:170open in new window

reduce<T>(predicate, initialValue): T

Type parameters

Name
T

Parameters

NameType
predicate(previousValue: T, currentValue: C, currentIndex: number, array: C[]) => T
initialValueT

Returns

T

Inherited from

Collection.reduce

Defined in

lib/utils/Collection.ts:180open in new window


reduceRight

reduceRight(predicate): C

See: Array#reduceRightopen in new window

Parameters

NameType
predicate(previousValue: C, currentValue: C, currentIndex: number, array: C[]) => C

Returns

C

Inherited from

Collection.reduceRight

Defined in

lib/utils/Collection.ts:203open in new window

reduceRight(predicate, initialValue): C

Parameters

NameType
predicate(previousValue: C, currentValue: C, currentIndex: number, array: C[]) => C
initialValueC

Returns

C

Inherited from

Collection.reduceRight

Defined in

lib/utils/Collection.ts:212open in new window

reduceRight<T>(predicate, initialValue): T

Type parameters

Name
T

Parameters

NameType
predicate(previousValue: T, currentValue: C, currentIndex: number, array: C[]) => T
initialValueT

Returns

T

Inherited from

Collection.reduceRight

Defined in

lib/utils/Collection.ts:222open in new window


set

set(key, value): TypedCollection<K, M, C, E>

Adds a new element with a specified key and value to the Map. If an element with the same key already exists, the element will be updated.

Parameters

NameType
keyK
valueC

Returns

TypedCollection<K, M, C, E>

Inherited from

Collection.set

Defined in

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


some

some<ThisArg>(predicate, thisArg?): boolean

See: Array#someopen in new window

Type parameters

NameType
ThisArgCollection<K, C>

Parameters

NameType
predicate(value: C, index: number, array: C[]) => unknown
thisArg?ThisArg

Returns

boolean

Inherited from

Collection.some

Defined in

lib/utils/Collection.ts:245open in new window


toArray

toArray(): C[]

Get the values of this collection as an array.

Returns

C[]

Inherited from

Collection.toArray

Defined in

lib/utils/Collection.ts:253open in new window


values

values(): IterableIterator<C>

Returns an iterable of values in the map

Returns

IterableIterator<C>

Inherited from

Collection.values

Defined in

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

Last Updated:
Contributors: Reinhardt