moderator-toolbox-nxg-for-reddit / modules/modmatrix/filterUtils

modules/modmatrix/filterUtils

Functions

isFilterItemChecked()

isFilterItemChecked(current, item): boolean

Defined in: extension/data/modules/modmatrix/filterUtils.ts:8

Returns whether a single item is currently shown under the given filter.

Parameters

current

string[] | null

Active filter array, or null meaning all items are shown.

item

string

The item to test.

Returns

boolean


toggleFilterItem()

toggleFilterItem(current, all, item, add): string[] | null

Defined in: extension/data/modules/modmatrix/filterUtils.ts:21

Returns the updated filter after toggling a single item in or out of the active set. Returns null (meaning “show all”) whenever the result would include every item in all.

Parameters

current

string[] | null

Active filter array, or null meaning all items are currently shown.

all

string[]

Complete list of all possible items.

item

string

The item being toggled.

add

boolean

true to add the item; false to remove it.

Returns

string[] | null