Constructor
new BooleanFilter(params)
Parameters:
| Name | Type | Description | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
params |
BooleanFilterArgs | The filter arguments.
Properties
|
Properties:
| Name | Type | Attributes | Description |
|---|---|---|---|
description |
string |
<optional> |
Optional description of the filter for display or documentation purposes. |
invertSelection |
boolean |
<optional> |
If true, the filter logic is inverted (e.g. exclude instead of include). |
options |
BooleanFilterOptionList | The BooleanFilterOptions available for this filter. | |
propretyName |
BooleanFilterName | The BooleanFilterOptions available for this filter. | |
selectedOptions |
Array.<string> | The names of the options selected for use in filtering. |
Extends
- TootFilter
- undefined
Members
options
Set
this._options and remove invalid values from this.selectedOptions.
Methods
isAllowed(toot) → {boolean}
Return true if the
Toot matches the filter.
Parameters:
| Name | Type | Description |
|---|---|---|
toot |
Toot | The toot to check. |
Returns:
- Type
- boolean
isOptionEnabled(optionName) → {boolean}
Return true if the option is in
this.selectedOptions.
Parameters:
| Name | Type | Description |
|---|---|---|
optionName |
string | The option name. |
Returns:
- Type
- boolean
optionsSortedByName(minTootsopt, includeFollowedopt) → {BooleanFilterOptionList}
Return options with
numToots >= minToots sorted by name
(this.selectedOptions are always included).
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
minToots |
number |
<optional> |
0 | Minimum number of toots. |
includeFollowed |
boolean |
<optional> |
false | Always include options with isFollowed set to true. |
Returns:
optionsSortedByValue(minTootsopt, includeFollowedopt) → {BooleanFilterOptionList}
Return options with
numToots >= minToots sorted by numToots
(this.selectedOptions are always included).
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
minToots |
number |
<optional> |
0 | Minimum number of toots. |
includeFollowed |
boolean |
<optional> |
false | Always include options with isFollowed set to true. |
Returns:
toArgs() → {BooleanFilterArgs}
Required for serialization of settings to local storage.
- Overrides:
Returns:
Serialized arguments used to construct this filter.
- Type
- BooleanFilterArgs
updateOption(optionName, isSelected, allowMultiSelectopt)
Add or remove an option to/remove an option from
this.selectedOptions.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
optionName |
string | The option name. | ||
isSelected |
boolean | If true, add the option; if false, remove it. | ||
allowMultiSelect |
boolean |
<optional> |
true | If false, only one option can be selected at a time. |
(static) isValidFilterProperty(name) → {boolean}
Checks if a given property name is a valid
BooleanFilterName.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | The property name to check. |
Returns:
True if the name is a filterable numeric property.
- Type
- boolean