Class: TagList

TagList()

Subclass of ObjWithCountList for lists of TagWithUsageCounts objects.

Constructor

new TagList()


Extends

Methods

getObj(name) → {T|undefined}

Returns the object in the list with the given name, or undefined if not found. Name matching is case-insensitive.
Parameters:
Name Type Description
name string The name of the object to retrieve.
Overrides:
Returns:
The object with the specified name, or undefined if not found.
Type
T | undefined

maxValue() → {number|undefined}

Get the maximum value for a given key across the objs array
Overrides:
Returns:
The maximum value for the specified property, or undefined if none exist.
Type
number | undefined

nameToNumTootsDict() → {StringNumberDict}

Returns a dict of 'obj.name' to 'obj.numToots'.
Overrides:
Returns:
Dictionary mapping object names to their numToots counts.
Type
StringNumberDict

populateByCountingProps(objs, propExtractor) → {void}

Populate the objs array by counting the number of times each 'name' (given by propExtractor) appears Resulting BooleanFilterOptions will be decorated with properties returned by propExtractor().
Parameters:
Name Type Description
objs Array.<U> Array of objects to count properties from.
propExtractor function Function to extract the properties to count from each object.
Overrides:
Returns:
Type
void

removeKeywords() → {Promise.<void>}

Remove any obj whose 'name' is watches any of 'keywords'.
Overrides:
Returns:
Type
Promise.<void>

(async) removeMutedTags() → {Promise.<void>}

Remove any obj whose 'name' is muted by the user's server side filters. TODO: use UserData's cached muted keywords regex?
Overrides:
Returns:
Type
Promise.<void>

topObjs(maxObjsopt) → {Array.<T>}

Returns the objs in the list sorted by numAccounts if it exists, otherwise by numToots, and then by name. If maxObjs is provided, returns only the top maxObjs objects.
Parameters:
Name Type Attributes Description
maxObjs number <optional>
Optional maximum number of objects to return.
Overrides:
Returns:
Objects sorted by numAccounts if it exists, otherwise numToots, then by name
Type
Array.<T>