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 🙏

© 2025 – Pkg Stats / Ryan Hefner

query-utilities

v0.0.1

Published

Complex query

Downloads

3

Readme

Query Utilities

Demo Published on npm

Query utilities for javascript with zero dependencies.

Search "Anything" AND (Get better >= results) OR build TO extend
  • ✅ No Dependencies
  • ✅ ES Modules
  • ✅ Full Browser Support
  • ✅ 100% Typescript

Methods

'parseQuery`

Returns a query from a given string.

const result = parseQuery("this AND that");
console.log(result); // Returns AndQuery

highlight

Highlight function that wraps the referenced text with a <mark> tag.

const result = highlight("test highlight", "test");
console.log(result); // Returns "<mark>test</mark> highlight"

Classes

SearchQuery

const query = new SearchQuery<any>();
query.addSource("todos", todos, (item, search) => ({
    type: "TODO",
    item,
    search,
}));
query.addSource("users", users, (item, search) => ({
    type: "USER",
    item,
    search,
}));
const search = 'userId: 1';
const results = query.getResults(search);
console.log(results); // One result with user id === 1

This package also includes all the classes used in parsing and for building results:

Query

Base class that all extend from and implement.

TextQuery and PhraseQuery

Basic text query that can optionally be an exact match if the source starts and ends with a quote character. The returned string is trimmed.

"test" --> test
hello world --> hello world
test "inner" quotes --> test "inner" quotes
"trimmed  " --> trimmed

AndQuery

Joins two statements with the AND token and each side can extend Query.

this AND that

OrQuery

Joins two statements with the OR token and each side can extend Query.

this OR that

NotQuery

Negates the targeted query.

NOT this

SectionQuery

Specifies a query on a given section or return the section if not specified.

@users userId:1 -> user with id = 1
@todos -> all todos

GroupQuery

Group a query with ().

active todos AND NOT (completed:true OR stale)

FieldScope

Target a query on a specified field.

active:true -> fields where active field === true

FieldCompareQuery

Target a query on a specified field with a operator and text query.

id >= 2 -> ids where value is greater or equal to 2

RangeQuery

Search a range (inclusive or exclusive) with a start and end query.

[200 TO 2000} -> range from inclusive 200 to exclusive 2000