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 🙏

© 2024 – Pkg Stats / Ryan Hefner

noch-query-parser

v1.0.4

Published

The Parser class is a robust utility designed to convert query strings into structured objects of type FilterQuery.

Downloads

8

Readme

Query String Parser

Overview

The Parser class is a robust utility designed to convert query strings into structured objects of type FilterQuery. This functionality is critical in applications where data retrieval or manipulation is contingent upon dynamic user inputs. This class streamlines the parsing process, offering a standardized method to interpret complex query strings into actionable database queries or data processing commands.

Query Structure

Queries are structured in the following format:

filter=type:field:operator:value

Type

Specifies the data type of the field being queried. Supported types include:

   - s (String): Textual data.
   - b (Boolean): Boolean values (true or false).
   - n (Number): Numeric data.
   - d (Date): Date values.
   - v (Void): Represents null or undefined values.

Field

Indicates the name of the data field targeted by the query, typically corresponding to database column names or keys in JSON objects.

Operator

Operators define how the field's value is evaluated, with available options varying based on the data type:

  -  =: Equal to
  -  !=: Not equal to
  -  >: Greater than
  -  >=: Greater than or equal to
  -  <: Less than
  -  <=: Less than or equal to
  -  ><: Inclusive range
  -  >!<: Exclusive range
  -  <>: Exists
  -  <!>: Does not exist
  -  !!: Boolean NOT
  -  !: Negation

Value

The value must conform to restrictions imposed by the field's type and the chosen operator. For example:

    Booleans (b): Only = and != with true or false.
        b:verified:=:true: Verifies if the field is true.
        b:verified:=:false: Verifies if the field is false.
        b:verified:!=:true: Verifies if the field is not true.
        b:verified:!=:false: Verifies if the field is not false.

For types such as date (d) and number (n), operators like =, !=, >, >=, <, <=, and range operators (><, >!<) are applicable. Range operators should specify a lower and higher boundary:

filter=type:field:operator:[lower,higher]

This defines a range with boundaries lower and higher, where the inclusivity or exclusivity is determined by the operator.