Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
search-filter-options
Advanced tools
Incremental tokenizer
UX of project requires filter with large amount of fields (20-30), e.g.
email
, provider
, status
etc. with any combinations of theese fields.
Solution - make search string filter which transform string like
:provider stripe :status pending
into object like
{
provider: 'stripe',
status: 'pending'
}
Create instance of parser and parse
var sfo = new SearchFilterOptions();
...
sfo.parse(' :provider stripe :status pending ');
SearchFilterOptions({ sigil = ':', keys = [], trim = true } = {})
where
:
{ name: 'name of key', flag: 'optional, true if this variable is a flag'}
true
{
data: { //all found keys
key: {
value: 'string'
}
},
expected: { //all expected keywords that matches `keys` argument in constructor
key: {
value: string,
exists: boolean,
flag: boolean
}
},
extra: string //everything before first keyword
}
parse(string)
- return result object. Parser saves previous state, and if next string differs by one letter,
then restore previous state and increment data
see test file on github.com
FAQs
Tokenize search string in groups of options for search filter
The npm package search-filter-options receives a total of 0 weekly downloads. As such, search-filter-options popularity was classified as not popular.
We found that search-filter-options demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.