hoshii / Exports / Collection

Collection<K, V>

Type parameters

Name
K
V

Hierarchy

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new Collection<K, V>(entries?)

Type parameters

Name
K
V

Parameters

NameType
entries?readonly readonly [K, V][]

Inherited from

Map<K, V>.constructor

Defined in

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

new Collection<K, V>(iterable?)

Type parameters

Name
K
V

Parameters

NameType
iterable?Iterable<readonly [K, V]>

Inherited from

Map<K, V>.constructor

Defined in

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

Properties

[toStringTag]

Readonly [toStringTag]: string

Inherited from

Map.__@toStringTag@262

Defined in

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


size

Readonly size: number

Inherited from

Map.size

Defined in

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


[species]

Static Readonly [species]: MapConstructor

Inherited from

Map.__@species@480

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

Defined in

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

Methods

[iterator]

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

Returns an iterable of entries in the map.

Returns

IterableIterator<[K, V]>

Inherited from

Map.__@iterator@47

Defined in

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


clear

clear(): void

Returns

void

Inherited from

Map.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

Map.delete

Defined in

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


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


every

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

See: Array#everyopen in new window

Type parameters

NameType
TT
ThisArgCollection<K, V>

Parameters

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

Returns

this is T[]

Defined in

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

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

Type parameters

NameType
ThisArgCollection<K, V>

Parameters

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

Returns

boolean

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
SS
ThisArgCollection<K, V>

Parameters

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

Returns

S[]

Defined in

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

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

Type parameters

NameType
ThisArgCollection<K, V>

Parameters

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

Returns

V[]

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
SS
ThisArgCollection<K, V>

Parameters

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

Returns

S

Defined in

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

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

Type parameters

NameType
ThisArgCollection<K, V>

Parameters

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

Returns

V

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: V, index: number, obj: V[]) => unknown
thisArg?unknown

Returns

number

Defined in

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


first

first(): V

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

Returns

V

Defined in

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

first(amount): V[]

Parameters

NameType
amountnumber

Returns

V[]

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: 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:31


get

get(key): V

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

V

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

Inherited from

Map.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

Map.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

Map.keys

Defined in

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


last

last(): V

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

Returns

V

Defined in

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

last(amount): V[]

Parameters

NameType
amountnumber

Returns

V[]

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: V, index: number, obj: V[]) => T
thisArg?unknown

Returns

T[]

Defined in

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


random

random(): V

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

Returns

V

Defined in

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


reduce

reduce(predicate): V

See: Array#reduceopen in new window

Parameters

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

Returns

V

Defined in

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

reduce(predicate, initialValue): V

Parameters

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

Returns

V

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: V, currentIndex: number, array: V[]) => T
initialValueT

Returns

T

Defined in

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


reduceRight

reduceRight(predicate): V

See: Array#reduceRightopen in new window

Parameters

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

Returns

V

Defined in

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

reduceRight(predicate, initialValue): V

Parameters

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

Returns

V

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: V, currentIndex: number, array: V[]) => T
initialValueT

Returns

T

Defined in

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


set

set(key, value): Collection<K, V>

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
valueV

Returns

Collection<K, V>

Inherited from

Map.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, V>

Parameters

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

Returns

boolean

Defined in

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


toArray

toArray(): V[]

Get the values of this collection as an array.

Returns

V[]

Defined in

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


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

Last Updated:
Contributors: Reinhardt