Preview environment

class LimitedCollection

extends

Collection<Key, Value>
export class LimitedCollection<Key, Value> extends Collection<Key, Value>

A Collection which holds a max amount of entries.

Constructors

constructor(
options?: LimitedCollectionOptions<Key, Value>
iterable?: Iterable<readonly [Key, Value]>
)

Type Parameters

Key

Value

keepOverLimit : ((value: Value, key: Key, collection: this) => boolean) | null

A function called to check if an entry should be kept when the Collection is at max size.

maxSize : number

The max size of the Collection.