Skip to content

LimitedCollection

classe · Source

A Collection which holds a max amount of entries and sweeps periodically.

Extends: Collection

Constructor

new LimitedCollection(options?: LimitedCollectionOptions, iterable?: Iterable)

Parameters

NameTypeDescription
options?LimitedCollectionOptionsOptions for constructing the Collection. Default: {}.
iterable?IterableOptional entries passed to the Map constructor. Default: null.

Properties

maxSize

maxSize: number

The max size of the Collection. Source

keepOverLimit

nullable

keepOverLimit: function

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

sweepFilter

nullable · deprecated

sweepFilter: SweepFilter

A function called every sweep interval that returns a function passed to sweep. Source

interval

nullable · deprecated

interval: Timeout

The id of the interval being used to sweep. Source

Methods

filterByLifetime

static · deprecated

filterByLifetime(options?: LifetimeFilterOptions): SweepFilter

Create a sweepFilter function that uses a lifetime to determine sweepability. Parameters

NameTypeDescription
options?LifetimeFilterOptionsThe options used to generate the filter function Default: {}.

Returns: SweepFilterSource

Unofficial software. Not affiliated with or supported by Discord.