Collection<K, V>
Type parameters
Name |
---|
K |
V |
Hierarchy
Map
<K
,V
>↳
Collection
Table of contents
Constructors
Properties
Accessors
Methods
- [iterator]
- clear
- delete
- entries
- every
- filter
- find
- findIndex
- first
- forEach
- get
- has
- keys
- last
- map
- random
- reduce
- reduceRight
- set
- some
- toArray
- values
Constructors
constructor
• new Collection<K
, V
>(entries?
)
Type parameters
Name |
---|
K |
V |
Parameters
Name | Type |
---|---|
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
Name | Type |
---|---|
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
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
Name | Type |
---|---|
key | K |
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#every
Type parameters
Name | Type |
---|---|
T | T |
ThisArg | Collection <K , V > |
Parameters
Name | Type |
---|---|
predicate | (value : V , index : number , array : V []) => value is T |
thisArg? | ThisArg |
Returns
this is T[]
Defined in
▸ every<ThisArg
>(predicate
, thisArg?
): boolean
Type parameters
Name | Type |
---|---|
ThisArg | Collection <K , V > |
Parameters
Name | Type |
---|---|
predicate | (value : V , index : number , array : V []) => unknown |
thisArg? | ThisArg |
Returns
boolean
Defined in
filter
▸ filter<S
, ThisArg
>(predicate
, thisArg?
): S
[]
See: Array#filter
Type parameters
Name | Type |
---|---|
S | S |
ThisArg | Collection <K , V > |
Parameters
Name | Type |
---|---|
predicate | (this : ThisArg , value : V , index : number , array : V []) => value is S |
thisArg? | ThisArg |
Returns
S
[]
Defined in
▸ filter<ThisArg
>(predicate
, thisArg?
): V
[]
Type parameters
Name | Type |
---|---|
ThisArg | Collection <K , V > |
Parameters
Name | Type |
---|---|
predicate | (this : ThisArg , value : V , index : number , array : V []) => unknown |
thisArg? | ThisArg |
Returns
V
[]
Defined in
find
▸ find<S
, ThisArg
>(predicate
, thisArg?
): S
See: Array#find
Type parameters
Name | Type |
---|---|
S | S |
ThisArg | Collection <K , V > |
Parameters
Name | Type |
---|---|
predicate | (this : ThisArg , value : V , index : number , obj : V []) => value is S |
thisArg? | ThisArg |
Returns
S
Defined in
▸ find<ThisArg
>(predicate
, thisArg?
): V
Type parameters
Name | Type |
---|---|
ThisArg | Collection <K , V > |
Parameters
Name | Type |
---|---|
predicate | (this : ThisArg , value : V , index : number , obj : V []) => unknown |
thisArg? | ThisArg |
Returns
V
Defined in
findIndex
▸ findIndex(predicate
, thisArg?
): number
See: Array#findIndex
Parameters
Name | Type |
---|---|
predicate | (value : V , index : number , obj : V []) => unknown |
thisArg? | unknown |
Returns
number
Defined in
first
▸ first(): V
Get the first element, or first X elements if a number is provided.
Returns
V
Defined in
▸ first(amount
): V
[]
Parameters
Name | Type |
---|---|
amount | number |
Returns
V
[]
Defined in
forEach
▸ forEach(callbackfn
, thisArg?
): void
Executes a provided function once per each key/value pair in the Map, in insertion order.
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: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
Name | Type |
---|---|
key | K |
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
Name | Type |
---|---|
key | K |
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
▸ last(amount
): V
[]
Parameters
Name | Type |
---|---|
amount | number |
Returns
V
[]
Defined in
map
▸ map<T
>(predicate
, thisArg?
): T
[]
See: Array#map
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
predicate | (value : V , index : number , obj : V []) => T |
thisArg? | unknown |
Returns
T
[]
Defined in
random
▸ random(): V
Pick a random element from the collection, or undefined if the collection is empty.
Returns
V
Defined in
reduce
▸ reduce(predicate
): V
See: Array#reduce
Parameters
Name | Type |
---|---|
predicate | (previousValue : V , currentValue : V , currentIndex : number , array : V []) => V |
Returns
V
Defined in
▸ reduce(predicate
, initialValue
): V
Parameters
Name | Type |
---|---|
predicate | (previousValue : V , currentValue : V , currentIndex : number , array : V []) => V |
initialValue | V |
Returns
V
Defined in
▸ reduce<T
>(predicate
, initialValue
): T
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
predicate | (previousValue : T , currentValue : V , currentIndex : number , array : V []) => T |
initialValue | T |
Returns
T
Defined in
reduceRight
▸ reduceRight(predicate
): V
See: Array#reduceRight
Parameters
Name | Type |
---|---|
predicate | (previousValue : V , currentValue : V , currentIndex : number , array : V []) => V |
Returns
V
Defined in
▸ reduceRight(predicate
, initialValue
): V
Parameters
Name | Type |
---|---|
predicate | (previousValue : V , currentValue : V , currentIndex : number , array : V []) => V |
initialValue | V |
Returns
V
Defined in
▸ reduceRight<T
>(predicate
, initialValue
): T
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
predicate | (previousValue : T , currentValue : V , currentIndex : number , array : V []) => T |
initialValue | T |
Returns
T
Defined in
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
Name | Type |
---|---|
key | K |
value | V |
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#some
Type parameters
Name | Type |
---|---|
ThisArg | Collection <K , V > |
Parameters
Name | Type |
---|---|
predicate | (value : V , index : number , array : V []) => unknown |
thisArg? | ThisArg |
Returns
boolean
Defined in
toArray
▸ toArray(): V
[]
Get the values of this collection as an array.
Returns
V
[]
Defined in
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