hoshii / Exports / TypedCollection
TypedCollection<K, M, C, E>
Type parameters
| Name | Type |
|---|---|
K | extends string | number |
M | extends Record<string, any> |
C | extends Base |
E | extends unknown[] = [] |
Hierarchy
Collection<K,C>↳
TypedCollection
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 TypedCollection<K, M, C, E>(baseObject, client, limit?)
Type parameters
| Name | Type |
|---|---|
K | extends string | number |
M | extends Record<string, any> |
C | extends Base<string | number, C> |
E | extends unknown[] = [] |
Parameters
| Name | Type | Default value |
|---|---|---|
baseObject | AnyClass<M, C, E> | undefined |
client | Client | undefined |
limit | number | Infinity |
Overrides
Defined in
lib/utils/TypedCollection.ts:23
Properties
[toStringTag]
• Readonly [toStringTag]: string
Inherited from
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:17
_client
• Private _client: Client
Defined in
lib/utils/TypedCollection.ts:19
limit
• limit: number
Defined in
lib/utils/TypedCollection.ts:21
size
• Readonly size: number
Inherited from
Defined in
node_modules/typescript/lib/lib.es2015.collection.d.ts:48
[species]
▪ Static Readonly [species]: MapConstructor
Inherited from
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
Methods
[iterator]
▸ [iterator](): IterableIterator<[K, C]>
Returns an iterable of entries in the map.
Returns
IterableIterator<[K, C]>
Inherited from
Defined in
node_modules/typescript/lib/lib.es2015.iterable.d.ts:121
clear
▸ clear(): void
Returns
void
Inherited from
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
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
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 | extends Base<string | number, T> |
ThisArg | Collection<K, C> |
Parameters
| Name | Type |
|---|---|
predicate | (value: C, index: number, array: C[]) => value is T |
thisArg? | ThisArg |
Returns
this is T[]
Inherited from
Defined in
▸ every<ThisArg>(predicate, thisArg?): boolean
Type parameters
| Name | Type |
|---|---|
ThisArg | Collection<K, C> |
Parameters
| Name | Type |
|---|---|
predicate | (value: C, index: number, array: C[]) => unknown |
thisArg? | ThisArg |
Returns
boolean
Inherited from
Defined in
filter
▸ filter<S, ThisArg>(predicate, thisArg?): S[]
See: Array#filter
Type parameters
| Name | Type |
|---|---|
S | extends Base<string | number, S> |
ThisArg | Collection<K, C> |
Parameters
| Name | Type |
|---|---|
predicate | (this: ThisArg, value: C, index: number, array: C[]) => value is S |
thisArg? | ThisArg |
Returns
S[]
Inherited from
Defined in
▸ filter<ThisArg>(predicate, thisArg?): C[]
Type parameters
| Name | Type |
|---|---|
ThisArg | Collection<K, C> |
Parameters
| Name | Type |
|---|---|
predicate | (this: ThisArg, value: C, index: number, array: C[]) => unknown |
thisArg? | ThisArg |
Returns
C[]
Inherited from
Defined in
find
▸ find<S, ThisArg>(predicate, thisArg?): S
See: Array#find
Type parameters
| Name | Type |
|---|---|
S | extends Base<string | number, S> |
ThisArg | Collection<K, C> |
Parameters
| Name | Type |
|---|---|
predicate | (this: ThisArg, value: C, index: number, obj: C[]) => value is S |
thisArg? | ThisArg |
Returns
S
Inherited from
Defined in
▸ find<ThisArg>(predicate, thisArg?): C
Type parameters
| Name | Type |
|---|---|
ThisArg | Collection<K, C> |
Parameters
| Name | Type |
|---|---|
predicate | (this: ThisArg, value: C, index: number, obj: C[]) => unknown |
thisArg? | ThisArg |
Returns
C
Inherited from
Defined in
findIndex
▸ findIndex(predicate, thisArg?): number
See: Array#findIndex
Parameters
| Name | Type |
|---|---|
predicate | (value: C, index: number, obj: C[]) => unknown |
thisArg? | unknown |
Returns
number
Inherited from
Defined in
first
▸ first(): C
Get the first element, or first X elements if a number is provided.
Returns
C
Inherited from
Defined in
▸ first(amount): C[]
Parameters
| Name | Type |
|---|---|
amount | number |
Returns
C[]
Inherited from
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: C, key: K, map: Map<K, C>) => void |
thisArg? | any |
Returns
void
Inherited from
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
| Name | Type |
|---|---|
key | K |
Returns
C
Returns the element associated with the specified key. If no element is associated with the specified key, undefined is returned.
Inherited from
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
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
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
Defined in
▸ last(amount): C[]
Parameters
| Name | Type |
|---|---|
amount | number |
Returns
C[]
Inherited from
Defined in
map
▸ map<T>(predicate, thisArg?): T[]
See: Array#map
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
predicate | (value: C, index: number, obj: C[]) => T |
thisArg? | unknown |
Returns
T[]
Inherited from
Defined in
random
▸ random(): C
Pick a random element from the collection, or undefined if the collection is empty.
Returns
C
Inherited from
Defined in
reduce
▸ reduce(predicate): C
See: Array#reduce
Parameters
| Name | Type |
|---|---|
predicate | (previousValue: C, currentValue: C, currentIndex: number, array: C[]) => C |
Returns
C
Inherited from
Defined in
▸ reduce(predicate, initialValue): C
Parameters
| Name | Type |
|---|---|
predicate | (previousValue: C, currentValue: C, currentIndex: number, array: C[]) => C |
initialValue | C |
Returns
C
Inherited from
Defined in
▸ reduce<T>(predicate, initialValue): T
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
predicate | (previousValue: T, currentValue: C, currentIndex: number, array: C[]) => T |
initialValue | T |
Returns
T
Inherited from
Defined in
reduceRight
▸ reduceRight(predicate): C
See: Array#reduceRight
Parameters
| Name | Type |
|---|---|
predicate | (previousValue: C, currentValue: C, currentIndex: number, array: C[]) => C |
Returns
C
Inherited from
Defined in
▸ reduceRight(predicate, initialValue): C
Parameters
| Name | Type |
|---|---|
predicate | (previousValue: C, currentValue: C, currentIndex: number, array: C[]) => C |
initialValue | C |
Returns
C
Inherited from
Defined in
▸ reduceRight<T>(predicate, initialValue): T
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
predicate | (previousValue: T, currentValue: C, currentIndex: number, array: C[]) => T |
initialValue | T |
Returns
T
Inherited from
Defined in
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
| Name | Type |
|---|---|
key | K |
value | C |
Returns
TypedCollection<K, M, C, E>
Inherited from
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, C> |
Parameters
| Name | Type |
|---|---|
predicate | (value: C, index: number, array: C[]) => unknown |
thisArg? | ThisArg |
Returns
boolean
Inherited from
Defined in
toArray
▸ toArray(): C[]
Get the values of this collection as an array.
Returns
C[]
Inherited from
Defined in
values
▸ values(): IterableIterator<C>
Returns an iterable of values in the map
Returns
IterableIterator<C>
Inherited from
Defined in
node_modules/typescript/lib/lib.es2015.iterable.d.ts:136