🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

pg-filters

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pg-filters

Easily filter any list of data with ready to use functions.

1.1.0
latest
Source
npm
Version published
Weekly downloads
4
-20%
Maintainers
1
Weekly downloads
 
Created
Source

pg-filters

Functions

searchData

Filters data by using a single search string and matching its value with all the filters. Only uses Textand Number filters.

ParameterTypeUsage
dataany[]List of objects that need to be filtered.
filtersFilter[]List of filters that will be used to filter data.
searchstringWhat the user entered in the search box.

filterData

Filters data by using the filters.

ParameterTypeUsage
dataany[]List of objects that need to be filtered.
filtersFilter[]List of filters that will be used to filter data.

getActiveFilters

Returns all the filters that have a value.

ParameterTypeUsage
filtersFilter[]Filters to be evaluated.

resetFilters

Resets the value of the filters to their original state.

ParameterTypeUsage
filtersFilter[]Filters to be reset.

restoreFiltersFromStorage

Restores filters from a JSON storage, converting each field to its original state.

ParameterTypeUsage
storagestringJSON storage.

Filter Object

FieldUsageRequired
fieldMust match the field name inside the filtered object.
labelUsed to show the filter's name to the user.
inputTypeSpecifies the type of input that the user will interact with. Available types are Text, Number, Dropdown, MultiSelect, Calendar, CalendarRange and Checkbox
filterTypeSpecifies the method that will be used to filter.
valueUsed to compare values with the filtered object. User input goes there.
optionsUsed to populate a filter with options. Should only be used with Dropdown and MultiSelect.
emptySets the empty value to be matched with when filtering using Dropdown and MultiSelect.
categoryUsed to group fields together in a form.

Filter Types

Input TypeAssociated Filter TypesDefault
Number, CalendarLess, LessOrEqual, Equal, GreaterOrEqual, Greater.Equal
CheckboxTrue, False.True

FAQs

Package last updated on 20 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts