Skip to main content

Class: Collection<K, V>

Type parameters

Name
K
V

Hierarchy

  • Map<K, V>

    Collection

Constructors

constructor

new Collection<K, V>(limit?, entries?)

Type parameters

Name
K
V

Parameters

NameTypeDefault value
limitnumber0
entries?null | [K, V][]undefined

Overrides

Map<K, V\>.constructor

Defined in

packages/libcord/src/utils/Collection.ts:9

Properties

[toStringTag]

Readonly [toStringTag]: string

Inherited from

Map.__@toStringTag@24

Defined in

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


limit

limit: number

Param

limit of size of the collection, 0 = no limit

Param

Defined in

packages/libcord/src/utils/Collection.ts:7


size

Readonly size: number

Inherited from

Map.size

Defined in

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


[species]

Static Readonly [species]: MapConstructor

Inherited from

Map.__@species@589

Defined in

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

Methods

[iterator]

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

Returns an iterable of entries in the map.

Returns

IterableIterator<[K, V]>

Inherited from

Map.__@iterator@86

Defined in

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


add

add(obj, replace?): any

Parameters

NameTypeDefault value
objanyundefined
replacebooleanfalse

Returns

any

Defined in

packages/libcord/src/utils/Collection.ts:20


array

array(): any

Returns

any

Defined in

packages/libcord/src/utils/Collection.ts:82


clear

clear(): void

Returns

void

Inherited from

Map.clear

Defined in

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


delete

delete(key): boolean

Parameters

NameType
keyK

Returns

boolean

Inherited from

Map.delete

Defined in

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


entries

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

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

Returns

IterableIterator<[K, V]>

Inherited from

Map.entries

Defined in

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


filter

filter(cb): Collection<K, V>

Parameters

NameType
cb(value: V, key: K) => boolean

Returns

Collection<K, V>

Defined in

packages/libcord/src/utils/Collection.ts:48


find

find(cb): undefined | V

find a value in the collection

Example

client.guilds.find(guild => guild.name === 'cool name');

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `cb` | (`value`: `V`, `key`: `K`) => `boolean` | the callback for find the value |

#### Returns

`undefined` \| `V`

#### Defined in

[packages/libcord/src/utils/Collection.ts:42](https://github.com/Libcord/libcord/blob/755083c/packages/libcord/src/utils/Collection.ts#L42)

___

### forEach

**forEach**(`callbackfn`, `thisArg?`): `void`

#### Parameters

| Name | Type |
| :------ | :------ |
| `callbackfn` | (`value`: `V`, `key`: `K`, `map`: `Map`<`K`, `V`\>) => `void` |
| `thisArg?` | `any` |

#### Returns

`void`

#### Inherited from

Map.forEach

#### Defined in

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

___

### get

**get**(`key`): `undefined` \| `V`

#### Parameters

| Name | Type |
| :------ | :------ |
| `key` | `K` |

#### Returns

`undefined` \| `V`

#### Inherited from

Map.get

#### Defined in

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

___

### has

**has**(`key`): `boolean`

#### Parameters

| Name | Type |
| :------ | :------ |
| `key` | `K` |

#### Returns

`boolean`

#### Inherited from

Map.has

#### Defined in

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

___

### keys

**keys**(): `IterableIterator`<`K`\>

Returns an iterable of keys in the map

#### Returns

`IterableIterator`<`K`\>

#### Inherited from

Map.keys

#### Defined in

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

___

### set

**set**(`key`, `value`): `any`

#### Parameters

| Name | Type |
| :------ | :------ |
| `key` | `K` |
| `value` | `V` |

#### Returns

`any`

#### Overrides

Map.set

#### Defined in

[packages/libcord/src/utils/Collection.ts:14](https://github.com/Libcord/libcord/blob/755083c/packages/libcord/src/utils/Collection.ts#L14)

___

### toJSON

**toJSON**(`space?`): `string`

#### Parameters

| Name | Type | Default value |
| :------ | :------ | :------ |
| `space` | `number` | `1` |

#### Returns

`string`

#### Defined in

[packages/libcord/src/utils/Collection.ts:70](https://github.com/Libcord/libcord/blob/755083c/packages/libcord/src/utils/Collection.ts#L70)

___

### toObject

**toObject**(): `Object`

#### Returns

`Object`

#### Defined in

[packages/libcord/src/utils/Collection.ts:56](https://github.com/Libcord/libcord/blob/755083c/packages/libcord/src/utils/Collection.ts#L56)

___

### values

**values**(): `IterableIterator`<`V`\>

Returns an iterable of values in the map

#### Returns

`IterableIterator`<`V`\>

#### Inherited from

Map.values

#### Defined in

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