npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@comodinx/query-filters

v1.0.1

Published

@comodinx/query-filters is a module for parsing filters in string to object.

Readme

Query Filters

@comodinx/query-filters is a module for parsing filters in string to object.

Index

Download & Install

NPM

$ npm install @comodinx/query-filters

Source code

$ git clone https://github.com/comodinx/query-filters.git
$ cd query-filters
$ npm install

How is it used?

Simple usage

const { Parser } = require('@comodinx/query-filters');
const parser = new Parser();

parser.parse('active eq 1,description li %casa');
// { "active": { "eq": "1" }, "description": { "li": "%casa" } }

parser.parse('active eq 1,description li %casa,description eq depto');
// { "active": { "eq": "1" }, "description": { "li": "%casa", "eq": "depto" } }

Logical operators and groups

AND

  • Default operator
  • Represented by ,
active eq 1,description li %casa

OR

  • Represented by |
active eq 1|description li %casa

Groups

  • Represented by ( and )
active eq 1,(description li %casa|description eq depto)

Precedence

  • AND has higher precedence than OR
  • Use groups to control evaluation order
active eq 1,description li %casa|age ge 18
active eq 1,(description li %casa|age ge 18)

Parsed result example

parser.parse('active eq 1,(deleted_at is null|age ge 18)');
/*
{
  active: { eq: 1 },
  or: [
    { deleted_at: { is: 'null' } },
    { age: { ge: 18 } }
  ]
}
*/

Operators

| Name | Example | Description | |:-----|:-----------------------|:--------------------------------------------------------------| | eq | id eq 1 | Check equality. id = 1 | | ne | name ne nico | Check inequality. name != 'nico' | | gt | id gt 1 | Check greater than. id > 1 | | ge | id ge 10 | Check greater than or equal. id >= 10 | | lt | id lt 1 | Check less than. id < 1 | | le | id le 10 | Check less than or equal. id <= 10 | | li | name li nico% | Check matches with nico*. name like nico% | | nl | name nl nico% | Check not matches with nico*. name not like nico% | | in | id in [1;2;3] | Check if included on [1,2,3]. id in (1,2,3) | | ni | id ni [1;2;3] | Check if not included on [1,2,3]. id not in (1,2,3) | | be | id be [1;10] | Check if it is between a and b. id between (1 and 10) | | nb | id nb [1;10] | Check if it is not between a and b. id not between (1 and 10) | | is | deleted_at is null | Check if it is null. | | no | deleted_at is not null | Check if it is not null. |

Configurations

| Name | Type | Default | Description | |:----------------|:-------|:--------------------------------------------------|:-------------------------------------------------| | logicals | object | { or: '|', and: ',' } | Logical operators configuration. | | key | string | "[A-Za-z0-9_]+" | RegExp string for matching keys. | | value | string | ".+" | RegExp string for matching values. | | operators | array | ['eq','ne','gt','ge','lt','le','li','nl','in','ni','be','nb','is','no'] | | operatorPrefix | string | " " | Operator prefix. | | operatorSuffix | string | " " | Operator suffix. | | operatorFlags | string | "i" | Operator regexp flag. | | separatorGroups | string | ";" | List values separator. | | groups | object | { start: '(', end: ')' } | Conditions group delimiters. |

Format

const parser = new Parser();

parser.format({
  active: { eq: 1 },
  description: { li: '%casa' },
  or: [
    { deleted_at: { is: 'null' } },
    { age: { ge: 18 } }
  ]
});
// "active eq 1,description li %casa,(deleted_at is null|age ge 18)"

Tests

In order to see more concrete examples, I INVITE YOU TO LOOK AT THE TESTS :)

Run the unit tests

npm install
npm test